Handle Unicode text, emoji, encoding, normalization, code points, and safe storage.
Lessons
Loop through emoji without breaking sequences.
Iterating Over Emoji 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 Iterating Over Emoji example in a small scratch file, then explain what changed and why.