Javascript ArrayBuffer constructor

Introduction

The Javascript ArrayBuffer() constructor creates ArrayBuffer objects.

new ArrayBuffer(length)
Parameter Optional Meaning
length Required The size, in bytes, of the array buffer.

A new ArrayBuffer object are initialized to 0.

In this example, we create a 8-byte buffer with a Int32Array view referring to the buffer:

var buffer = new ArrayBuffer(8);
var view   = new Int32Array(buffer);
console.log(buffer);/*from   w w w  . ja  v  a  2s.c  om*/
console.log(view);



PreviousNext

Related