JS Built-ins
TextDecoderbeginner

TextDecoder.decode β€” empty Uint8Array

πŸ“– Usage Example
const dec = new TextDecoder()
dec.decode(new Uint8Array([]))  // β†’ ''

Decoding an empty buffer returns an empty string.

Decoding an Empty Buffer

new TextDecoder().decode(new Uint8Array([])) returns an empty string ''.

Challenge: Verify that decoding an empty byte array yields an empty string.

πŸ’‘ Hints (1)
  • β€’ No bytes means no characters β€” the result is an empty string.