Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong TypedArray constructors description #1380

Closed
sJJdGG opened this issue Nov 18, 2018 · 1 comment
Closed

Wrong TypedArray constructors description #1380

sJJdGG opened this issue Nov 18, 2018 · 1 comment

Comments

@sJJdGG
Copy link

sJJdGG commented Nov 18, 2018

In TypedArray Constructors the book says:

constructor(length): Creates a new view over a new buffer of length bytes

But it actually Creates a new view over a new buffer of length elements which means of (length * each element's size) byte.

Test:

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

Related PR: #1325

@getify
Copy link
Owner

getify commented Aug 28, 2019

(clearing out issues for second edition work)

@getify getify closed this as completed Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants