Standard built-ins

TypedArray.prototype.byteLength

Try the free JavaScript compiler

Byte span of the typed view, not necessarily the size of its backing buffer.

Formal Syntax & Structure

javascript syntaxjavascript
view.byteLength

Return Value

number

View size in bytes.

Working Example

Example Snippetjavascript
const a=new Uint16Array(new ArrayBuffer(8),2,2); console.log(a.byteLength,a.buffer.byteLength);
JavaScript Reference