TypedArray.BYTES_PER_ELEMENT
TypedArray.BYTES_PER_ELEMENT
TypedArray.BYTES_PER_ELEMENT
属性代表了强类型数组中每个元素所占用的字节数。
| TypedArray.BYTES_PER_ELEMENT的属性特性 |
|:----|
| Writable | no |
| Enumerable | no |
| Configurable | no |
语法
TypedArray.BYTES_PER_ELEMENT;
描述
强类型数组对象用来解释为单个元素的字节数是不一样的。常量 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
规范
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 | |
浏览器兼容性
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 7.0 | (Yes) | 4.0 (2) | 10 | 11.6 | 5.1 |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | 4.0 | (Yes) | (Yes) | 4.0 (2) | 10 | 11.6 | 4.2 |