Handle Unicode text, emoji, encoding, normalization, code points, and safe storage.
Lessons
Handle emoji sequences that may contain multiple code points.
Emoji Code Points and Grapheme Clusters is easiest to learn by reading the example, changing it, and observing the result.
const text = 'Hi👋🏽 family👨👩👧👦!';
// Wrong: counts UTF-16 code units, splits emoji
console.log(text.length);
// Right: count what the user perceives as characters
const seg = new Intl.Segmenter('en', { granularity: 'grapheme' });
const graphemes = [...seg.segment(text)].map(s => s.segment);
console.log(graphemes.length, graphemes);Practice the Emoji Code Points and Grapheme Clusters example in a small scratch file, then explain what changed and why.