Length

It's easy in Javascript to know how many characters are in a string using the property .length. The length property of an empty string is 0.


let size = "Our lovely string".length;
console.log(size);
// size: 17

let emptyStringSize = "".length
console.log(emptyStringSize);
// emptyStringSize: 0

Last updated

Was this helpful?