JS Built-ins
TextDecoderadvanced

TextDecoder.decode β€” round-trip '€'

πŸ“– Usage Example
const dec = new TextDecoder()
const ab = new ArrayBuffer(3)
new Uint8Array(ab).set([65, 66, 67])
dec.decode(ab)  // β†’ 'ABC'

decode() can also accept an ArrayBuffer directly.

Decoding Multi-byte UTF-8

The Euro sign '€' encodes as 3 bytes in UTF-8. Decoding those bytes recovers the original character.

Challenge: Verify the round-trip for '€'.

πŸ’‘ Hints (1)
  • β€’ € is U+20AC. Despite 3 bytes, decode returns a single character.