Handle Unicode text, emoji, encoding, normalization, code points, and safe storage.
Lessons
Check your understanding with practical questions.
UTF-8 & Emoji Quiz is easiest to learn by reading the example, changing it, and observing the result.
const message = 'Hello नमस्ते 😀';
// Declare encoding in HTML: <meta charset="UTF-8">
console.log('Code points:', [...message].length);
console.log('UTF-8 bytes:', new TextEncoder().encode(message).length);
// Last character's code point in hex
const last = [...message].at(-1);
console.log(last, '-> U+' + last.codePointAt(0).toString(16).toUpperCase());Practice the UTF-8 & Emoji Quiz example in a small scratch file, then explain what changed and why.