JS Built-ins
TextDecoderbeginner

TextDecoder β€” explicit utf-8 label

πŸ“– Usage Example
const dec = new TextDecoder('utf-8')
dec.encoding  // β†’ 'utf-8'

Pass an encoding label to TextDecoder; defaults to 'utf-8' if omitted.

TextDecoder with Explicit Label

new TextDecoder('utf-8').encoding returns 'utf-8'.

Challenge: Create a TextDecoder with 'utf-8' and verify the encoding property.

πŸ’‘ Hints (1)
  • β€’ Passing UTF-8 explicitly is the same as the default.