#Character Encoding
-
JavaScript String Length and Unicode
7 min read • Published on • Last Updated OnUnderstand why '👨👩👧👦'.length returns 11 instead of 1, and learn how to properly handle Unicode characters, grapheme clusters, and international text in JavaScript applications.TL;DRJavaScript’s string.length property counts UTF-16 code units, not user-perceived characters. Modern Unicode text—especially emoji and combining characters—requires multiple code units per visual character. Use Intl.Segmenter for grapheme-aware operations.