Example 1 — Quick demo
Core TextDecoder.
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.
| Topic | Summary |
|---|---|
basics | core TextDecoder usage. |
const dec = new TextDecoder();
const bytes = new Uint8Array([104, 105]);
console.log(dec.decode(bytes));Core TextDecoder.
const dec = new TextDecoder();
const bytes = new Uint8Array([104, 105]);
console.log(dec.decode(bytes));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