TypedArray.BYTES_PER_ELEMENT
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 |
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
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
BYTES_PER_ELEMENT |
7 |
12 |
4 |
10 |
11.6 |
5.1 |
4 |
18 |
4 |
12 |
4.2 |
1.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT