JavaScript(JS) string method - length

The length property is a property of a string object in JavaScript that returns the number of characters in the string.

Here is an example of using the length property:

refer to:‮‬theitroad.com
let str = "Hello World";
console.log(str.length); // 11

In the example above, the length property returns 11 because the str contains 11 characters, including the space between "Hello" and "World". The length property can be used on any string object to get the number of characters in the string.