Wrote a program to count the number of s(whitespaces, line-terminators) in a string, the string has no whitespaces but the output says otherwise.
The code –
str="helloworldhisistext"
count=0;
for(i=0; i<str.length; i++)
{
if(str[i]=='s')
{count++;}
}
console.log(count);
I expected ‘0’;
4