What string property returns the number of characters in a string?
The length property is a property of the String class that returns the number of characters that makes up the string. If the string is empty, then the length property will return 0. It can be accessed as follows.
var str = "hello world"; var count = str.length;
The variable str corresponds to an object of class String that contains the text "hello world" and dot (.) operator is used to access the property length. As the result of execution of the above statements, the variable count contains the value 11.