Because HTML is inherently string based. do JavaScript’s sibling do shell script returns strings, doesn’t it? Moreover do JavaScript itself accepts a string, and even if you send an integer it is sent as a string.
You are asking JavaScript to return the count of entries. Counts are always numbers.
do JavaScript ’s sibling do shell script returns strings
Shell is inherently text-based. You can’t enter numbers in the shell, only textual representations of digits, which the shell and/or executable interprets.
Notably, the do shell script definition specifically identifies its result as text:
FUNCTION SYNTAX
set theResult to do shell script text ¬
as type class ¬
administrator privileges boolean ¬
user name text ¬
password text ¬
with prompt text ¬
altering line endings boolean