Skip to content

doc: fix typo in buffer.md - should be uint16array

There is a typo inside doc/api/buffer.md, currently the code snippets look like this:

const buf = Buffer.from('hello', 'utf16le');
const uint16arr = new Uint16Array(
  buf.buffer,
  buf.byteOffset,
  buf.length / Uint16Array.BYTES_PER_ELEMENT);

console.log(uint16array);

// Prints: Uint16Array(5) [ 104, 101, 108, 108, 111 ]

But this snippets doesn't work as we've got this error:

console.log(uint16array);
            ^

ReferenceError: uint16array is not defined
    at Object.<anonymous> (/home/divlo/Documents/testing/test/app.js:7:13)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

To fix it, we need to change uint16arr to uint16array, with that change it effectively prints to stdout : Uint16Array(5) [ 104, 101, 108, 108, 111 ]. 👍

Merge request reports

Loading