Handle Unicode text, emoji, encoding, normalization, code points, and safe storage.
Lessons
Normalize text before comparing.
String.normalize() is easiest to learn by reading the example, changing it, and observing the result.
const text = 'café 😀';
// Iterate by code point (emoji-safe), not by UTF-16 unit
for (const ch of text) process(ch);
const chars = [...text];
// Normalize before comparing user input
const a = 'café';
console.log(a.normalize('NFC') === 'café'.normalize('NFC')); // truePractice the String.normalize() example in a small scratch file, then explain what changed and why.