JS: string length property

By Xah Lee. Date: .
length

length is number of Code Units in string.

if your string contains only character in Basic Multilingual Plane, then length is same as number of characters.

Example. basic

console.assert("abc".length === 3);

Example. contains emoji

console.assert("🦋".length === 2);