Handle Unicode text, emoji, encoding, normalization, code points, and safe storage.
Lessons
Treat equal-looking strings as equal.
Canonical Equivalence is easiest to learn by reading the example, changing it, and observing the result.
// "é" can be ONE code point or "e" + a combining accent.
const composed = 'café'; // é = U+00E9
const decomposed = 'café'; // e + U+0301
console.log(composed === decomposed); // false!
console.log(composed.length, decomposed.length); // 4 vs 5
// Normalize before comparing or storing
console.log(composed.normalize('NFC') === decomposed.normalize('NFC')); // truePractice the Canonical Equivalence example in a small scratch file, then explain what changed and why.