JS Built-ins
TextDecoderbeginner

TextDecoder β€” fatal property

πŸ“– Usage Example
const bytes = new Uint8Array([240,159,144,136])
new TextDecoder().decode(bytes)  // β†’ '🐈'

TextDecoder correctly handles multi-byte UTF-8 sequences like emoji.

TextDecoder fatal Property

The fatal option controls error handling. By default it is false, meaning invalid bytes are replaced with the replacement character U+FFFD.

Challenge: Verify that new TextDecoder().fatal === false.

πŸ’‘ Hints (1)
  • β€’ fatal: false means invalid bytes are silently replaced.