Standard built-ins

ArrayBuffer

Try the free JavaScript compiler

Allocates a zero-initialized fixed-length buffer when no options are supplied.

Formal Syntax & Structure

javascript syntaxjavascript
new ArrayBuffer(byteLength)

Parameters & Attributes

NameTypeDescription
byteLengthnumberRequested byte length.

Return Value

ArrayBuffer

Allocates a zero-initialized fixed-length buffer when no options are supplied.

Working Example

Example Snippetjavascript
(async () => {const b=new ArrayBuffer(4);console.log(b.byteLength,JSON.stringify([...new Uint8Array(b)]));})()
JavaScript Reference