Indeed it will give the length of a string. Even if a string behave like an array of characthers, it is not really an array as Array.isArray() will return false.
So yes the two code are not striclty equivalent. But it will do the job in a short and more elegant way.
And the way you showed is really nice, thanks.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Indeed it will give the length of a string. Even if a string behave like an array of characthers, it is not really an array as
Array.isArray()
will return false.So yes the two code are not striclty equivalent. But it will do the job in a short and more elegant way.
And the way you showed is really nice, thanks.