Example 1 — Example
Typical usage.
JavaScript
const dec = new TextDecoder();
const bytes = new Uint8Array([104, 105]);
console.log(dec.decode(bytes));How It Works
- Uint8Array. Raw bytes.
- decode. UTF-8 string.
TextDecoder decodes UTF-8 (or other) bytes back into a string.
const dec = new TextDecoder();
const bytes = new Uint8Array([104, 105]);
console.log(dec.decode(bytes));Typical usage.
const dec = new TextDecoder();
const bytes = new Uint8Array([104, 105]);
console.log(dec.decode(bytes));Check support.
console.log("TextDecoder — verify browser/Node support");CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful