The TypedArray.BYTES_PER_ELEMENT property represents the size in bytes of each element in an typed array.

Property attributes of TypedArray.BYTES_PER_ELEMENT
Writable no
Enumerable no
Configurable no

Syntax

TypedArray.BYTES_PER_ELEMENT;

Description

TypedArray objects differ from each other in the number of bytes per element and in the way the bytes are interpreted. The BYTES_PER_ELEMENT constant contains the number of bytes each element in the given TypedArray has.

Examples

Int8Array.BYTES_PER_ELEMENT;         // 1
Uint8Array.BYTES_PER_ELEMENT;        // 1
Uint8ClampedArray.BYTES_PER_ELEMENT; // 1
Int16Array.BYTES_PER_ELEMENT;        // 2
Uint16Array.BYTES_PER_ELEMENT;       // 2
Int32Array.BYTES_PER_ELEMENT;        // 4
Uint32Array.BYTES_PER_ELEMENT;       // 4
Float32Array.BYTES_PER_ELEMENT;      // 4
Float64Array.BYTES_PER_ELEMENT;      // 8

Specifications

Specification Status Comment
Typed Array Specification Obsolete Superseded by ECMAScript 6.
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'TypedArray.BYTES_PER_ELEMENT' in that specification.
Standard Initial definition in an ECMA standard.
ECMAScript Latest Draft (ECMA-262)
The definition of 'TypedArray.BYTES_PER_ELEMENT' in that specification.
Draft  

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support7 Yes41011.65.1
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support4 Yes Yes411.64.2 ?

See also

Document Tags and Contributors

 Contributors to this page: wbamberg, fscholz, jameshkramer
 Last updated by: wbamberg,