How to get the length of a string
Description
The string length is the number of 16-bit characters in the string.
The length of any string can be returned by using the length property as follows:
var text = "This is a test.";
console.log(text.length);
Example
The length of a string can be returned by using the length property:
var firstName = 'first';
console.log(firstName.length);
The code above generates the following result.