Length of strings

using .length property even the spaces are getting counted what is the alternative?

but you want to count spaces as well? They also take up memory

otherwise, you will need to write code to achieve this. You could use a simple for loop and a variable to count the characters. something like:

var counter = 0
for (var i = 0; i < string.length; i++){
    if (string[i] != " "){

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.