String.prototype.length

Returns the length of a string in UTF-16 code units. Note that it is not the same as the number of characters (or graphemes) in the string.

Syntax

length

Return value

A number.

Examples

"lava".length
4
"๐Ÿ˜€".length
2
"๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง".length
11

See also