TypedArray.BYTES_PER_ELEMENT
The TypedArray.BYTES_PER_ELEMENT
property represents the size in bytes of each element in an typed array.
Writable | no |
Enumerable | no |
Configurable | no |
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
Using BYTES_PER_ELEMENT
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
|
Desktop |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
BYTES_PER_ELEMENT |
7 |
12 |
4 |
10 |
11.6 |
5.1 |
|
Mobile |
|
Android webview |
Chrome for Android |
Firefox for Android |
Opera for Android |
Safari on iOS |
Samsung Internet |
BYTES_PER_ELEMENT |
4 |
18 |
4 |
12 |
4.2 |
1.0 |
|
Server |
|
Node.js |
BYTES_PER_ELEMENT |
0.10 |
See also