在线文档教程

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

规范

SpecificationStatusComment
Typed Array SpecificationObsoleteSuperseded by ECMAScript 6.
ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'TypedArray.BYTES_PER_ELEMENT' in that specification.StandardInitial definition in an ECMA standard.
ECMAScript Latest Draft (ECMA-262)The definition of 'TypedArray.BYTES_PER_ELEMENT' in that specification.Draft

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support7.0(Yes)4.0 (2)1011.65.1

FeatureAndroidChrome for AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support4.0(Yes)(Yes)4.0 (2)1011.64.2