You-Dont-Know-JS icon indicating copy to clipboard operation
You-Dont-Know-JS copied to clipboard

Update es6 & beyond - Chapter 5: Collections - TypedArray constructor description

Open sJJdGG opened this issue 7 years ago • 0 comments

As mentioned in MDN and other sources TypedArray(length) constructor makes a view of length elements not bytes. It can be also tested by:

var x = new Uint32Array(2);
console.log(x.length) // 2
console.log(x.byteLength) // 8
x[1] = 25;
console.log(x[1]); // 25

sJJdGG avatar Jul 28 '18 13:07 sJJdGG