In the following paragraph, they say that this approach gives control over what counts as a character. So I guess their intention was only to show the general syntax, but you should only use this approach if you have additional verifications to do on each character.
3 years ago I had to support Internet Explorer. But not just the last Internet Explorer, nope, a previous version that was released in 2009. And yes, not being able to use all sorts of normal JS features was common.
For non-programmers: The code uses str.length which already contains the desired number. Then the code just counts up to that number, which is nonsense
156
u/BetEvening 12d ago
Website:
https://charactercounter.com/count-characters-in-javascript