| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2c813d8 commit 9f8e442
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1185,13 +1185,9 @@ added: v8.3.0 | |||
| 1185 | 1185 | An implementation of the [WHATWG Encoding Standard][] `TextDecoder` API. | |
| 1186 | 1186 | ||
| 1187 | 1187 | ```js | |
| 1188 | - const decoder = new TextDecoder('shift_jis'); | ||
| 1189 | - let string = ''; | ||
| 1190 | - let buffer; | ||
| 1191 | - while (buffer = getNextChunkSomehow()) { | ||
| 1192 | - string += decoder.decode(buffer, { stream: true }); | ||
| 1193 | - } | ||
| 1194 | - string += decoder.decode(); // end-of-stream | ||
| 1188 | + const decoder = new TextDecoder(); | ||
| 1189 | + const u8arr = new Uint8Array([72, 101, 108, 108, 111]); | ||
| 1190 | + console.log(decoder.decode(u8arr)); // Hello | ||
| 1195 | 1191 | ``` | |
| 1196 | 1192 | ||
| 1197 | 1193 | ### WHATWG supported encodings | |
| Back | FazBrowse Home | New Git URL |
0 commit comments