Skip to main content
Version: 0.7.0

ArrayBuffer()

The ArrayBuffer() constructor is used to create "ArrayBuffer" objects.

Syntax

new ArrayBuffer(length)

Note: ArrayBuffer() can only be constructed with new. Attempting to call it without new throws a TypeError.

Parameters

  • length
    • : The size, in bytes, of the array buffer to create.

Return value

A new ArrayBuffer object of the specified size. Its contents are initialized to 0.

Exceptions

  • RangeError
    • : Thrown if the length is larger than Number_MAX_SAFE_INTEGER (≥ 253) or negative.