Name

TypedArray — fixed-size binary arrays

Inherits from

ArrayBufferView

Synopsis

A TypedArray is an ArrayBufferView that interprets the bytes of an underlying ArrayBuffer as an array of numbers and allows read and write access to the elements of that array. This page does not document a single type named TypedArray. Instead, it covers eight different kinds of typed arrays. These eight types are all subtypes of ArrayBufferView, and they differ from each other only in the number of bytes per array element and the way those bytes are interpreted. The eight actual types are:

Int8Array

One byte per array element, interpreted as a signed integer.

Int16Array

Two bytes per array element, interpreted as a signed integer, using platform byte order.

Int32Array

Four bytes per array element, interpreted as a signed integer, using platform byte order.

Uint8Array

One byte per array element, interpreted as an unsigned integer.

Uint16Array

Two bytes per array element, interpreted as an unsigned integer, using platform byte order.

Uint32Array

Four bytes per array element, interpreted as an unsigned integer, using platform byte order.

Float32Array

Four bytes per array element, interpreted as a floating-point number, using platform byte order.

Float64Array

Eight bytes per array element, interpreted as a floating-point number, using platform byte order.

As their name implies, these are array-like objects, and you can get and set element values using normal square-bracket array notation. Note, however, that objects of these ...

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.