ArrayBuffer()
The ArrayBuffer()
constructor is used to create "ArrayBuffer" objects.
Syntax
new ArrayBuffer(length)
Note:
ArrayBuffer()
can only be constructed withnew
. Attempting to call it withoutnew
throws aTypeError
.
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 thanNumber_MAX_SAFE_INTEGER
(≥ 253) or negative.
- : Thrown if the