Skip to content

Wrong TypedArray constructors description #1380

@sJJdGG

Description

@sJJdGG

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions