length property represents the length of a string.
length to not match the actual number of characters in the string.
For an empty string,
length is 0.
The static property
String.length returns the value 1.
var x = 'Mozilla'; var empty = ''; console.log('Mozilla is ' + x.length + ' code units long'); /* "Mozilla is 7 code units long" */ console.log('The empty string has a length of ' + empty.length); /* "The empty string has a length of 0" */