Javascript Int32Array Type

Introduction

A Int32Array object describes an array-like view of an underlying binary data buffer.

The constructors are listed as follows:

new Int32Array();
new Int32Array(length);
new Int32Array(typedArray);
new Int32Array(object);
new Int32Array(buffer [, byteOffset [, length]]);
Parameter Optional Meaning
length Requiredan internal array buffer is created of size length multiplied by BYTES_PER_ELEMENT bytes.
typedArrayRequiredthe typedArray is copied into a new typed array.
object Requireduse the Int32Array.from() method.
buffer Required create from buffer
byteOffset optional offset to start
length optionallength to copy

Property access

You can reference elements in the array using standard array index syntax.

var int16 = new Int32Array(2);
int16[0] = 42;//w  ww .  j av a2  s . co  m
console.log(int16[0]); // 42
Type Value Range Size in bytes DescriptionEquivalent C type
Int32Array-2147483648 to 2147483647 4 32-bit two's complement signed integer int32_t



PreviousNext

Related