Get to know MDN better
此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
该 Int32Array 类型表示在平台顺序字节中一个双补码 32 位有符号的整型数组。如果需要控制字节顺序,请改用 DataView。此内容的初始化为 0。一旦创建,你可以使用对象的方法或者标准数组索引的语法 (即使用括号表示法)。
更多关于构造函数语法和参数的详细信息,请参阅*TypedArray。*
Returns a number value of the element size. 4 in the case of an Int32Array.
Int32Array.lengthStatic length property whose value is 3. For the actual length (number of elements), see Int32Array.prototype.length.
Int32Array.prototypePrototype for the TypedArray objects.
从类似数组或者可迭代对象中创建一个新的 Int32Array。另见 Array.from().
Int32Array.of()创建一个新的具有可变数量参数的 Int32Array。另见 Array.of()。
还从其父接口 TypedArray 继承实例属性。
Int32Array.prototype.constructor返回创建实例原型的函数。默认情况下,它是 Int32Array 的构造函数。
Int32Array.prototype.buffer 只读返回在构造时被固定的 Int32Array 引用的 ArrayBuffer,因此只读。
Int32Array.prototype.byteLength 只读返回从其 ArrayBuffer 开始的 Int32Array 长度的 (以字节为单位)。在构造时被固定,因此只读。
Int32Array.prototype.byteOffset 只读返回从其 ArrayBuffer 开始的偏移量 (以字节为单位)。在构造时被固定,因此只读。
Int32Array.prototype.length 只读返回 Int32ArrayInt32Array 包含的元素个数。在构造时被固定,因此只读。
从其父接口 TypedArray 继承实例方法。
不同的方式创建一个 Int32Array
| ECMAScript® 2027 Language Specification # sec-typedarray-objects |
启用 JavaScript 以查看此浏览器兼容性表。
Starting with ECMAScript 2015 (ES6), In32Array constructors require to be constructed with a new operator. Calling a Int32Array constructor as a function without new, will throw a TypeError from now on.