Uint32Array表示一个由基于平台字节序的32位无符号字节组成的数组.如果需要对字节顺序进行控制(译者注:即 littleEndian 或 bigEndian),请使用DataView代替.数组中每个元素的初始值都是0.一旦创建,你可以用对象的方法引用数组里的元素,或者使用标准的数组索引语法(即,使用中括号)。
new Uint32Array(); // new in ES2017
new Uint32Array(length);
new Uint32Array(typedArray);
new Uint32Array(object);
new Uint32Array(buffer [, byteOffset [, length]]);
更多的构造器语法和属性请参照 TypedArray。
Uint32Array.BYTES_PER_ELEMENTUint32Array 返回4。Uint32Array.nameUint32Array 的返回值是: "Uint32Array"。Uint32Array.prototypeArray.from()。 未完成,请参考bug 896608。Array.of()。未完成,请参考 bug 896608.Uint32Array prototype所有Uint32Array 对象继承自 %TypedArray%.prototype.
Uint32Array.prototype.constructorUint32Array 的构造器。Uint32Array.prototype.buffer 只读 ArrayBuffer referenced by the Uint32Array Fixed at construction time and thus read only.Uint32Array.prototype.byteLength 只读 Uint32Array from the start of its ArrayBuffer. Fixed at construction time and thus read only.Uint32Array.prototype.byteOffset 只读 Uint32Array from the start of its ArrayBuffer. Fixed at construction time and thus read only.Uint32Array.prototype.length 只读 Uint32Array. Fixed at construction time and thus read only.Uint32Array.prototype.copyWithin()Array.prototype.copyWithin().Uint32Array.prototype.move() 未实现Uint32Array.prototype.copyWithin().Uint32Array.prototype.set()Uint32Array, reading input values from a specified array.Uint32Array.prototype.subarray()Uint32Array from the given start and end element index.// From a length
var uint32 = new Uint32Array(2);
uint32[0] = 42;
console.log(uint32[0]); // 42
console.log(uint32.length); // 2
console.log(uint32.BYTES_PER_ELEMENT); // 4
// From an array
var arr = new Uint32Array([21,31]);
console.log(arr[1]); // 31
// From another TypedArray
var x = new Uint32Array([21, 31]);
var y = new Uint32Array(x);
console.log(y[0]); // 21
// From an ArrayBuffer
var buffer = new ArrayBuffer(16);
var z = Uint32Array(buffer, 0, 4);
| Specification | Status | Comment |
|---|---|---|
| Typed Array Specification | Obsolete | Superseded by ECMAScript 6. |
| ECMAScript 2015 (6th Edition, ECMA-262) TypedArray constructors |
Standard | Initial definition in an ECMA standard. |
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 7.0 | 4.0 (2) | 10 | 11.6 | 5.1 |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | 4.0 | (Yes) | 4.0 (2) | 10 | 11.6 | 4.2 |