JS Built-ins
TextDecoderbeginner

TextDecoder.decode β€” single byte 72 is 'H'

πŸ“– Usage Example
const enc = new TextEncoder()
const buf = enc.encode('Hello')
new TextDecoder().decode(buf)  // β†’ 'Hello'

Combine TextEncoder.encode() and TextDecoder.decode() to round-trip strings.

Decoding a Single Byte

The byte value 72 is the ASCII code for 'H'. Decoding new Uint8Array([72]) yields 'H'.

Challenge: Verify that decode(new Uint8Array([72])) === 'H'.

πŸ’‘ Hints (1)
  • β€’ ASCII byte 72 corresponds to the character H.