diff --git a/doc/api/util.md b/doc/api/util.md index c9ba27fc39f4c4..801e668ec3106f 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1187,13 +1187,9 @@ added: v8.3.0 An implementation of the [WHATWG Encoding Standard][] `TextDecoder` API. ```js -const decoder = new TextDecoder('shift_jis'); -let string = ''; -let buffer; -while (buffer = getNextChunkSomehow()) { - string += decoder.decode(buffer, { stream: true }); -} -string += decoder.decode(); // end-of-stream +const decoder = new TextDecoder(); +const u8arr = new Uint8Array([72, 101, 108, 108, 111]); +console.log(decoder.decode(u8arr)); // Hello ``` ### WHATWG supported encodings