| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Int8Array | [Back] [Original] |
Get to know MDN better
new Int8Array(length); new Int8Array(typedArray); new Int8Array(object); new Int8Array(buffer [, byteOffset [, length]]);
Int8Array.BYTES_PER_ELEMENT Int8Array 1
Int8Array.prototypeTypedArray
Int8Array.from() int8Array Array.from()
Int8Array.of() Int8Array Array.of()
Int8Array.prototype.constructorInt8Array
Int8Array.prototype.buffer Returns the ArrayBuffer referenced by the Int8Array Fixed at construction time and thus read only.
Int8Array.prototype.byteLength Returns the length (in bytes) of the Int8Array from the start of its ArrayBuffer. Fixed at construction time and thus read only.
Int8Array.prototype.byteOffset Returns the offset (in bytes) of the Int8Array from the start of its ArrayBuffer. Fixed at construction time and thus read only.
Int8Array.prototype.length Returns the number of elements hold in the Int8Array. Fixed at construction time and thus read only.
//
var int8 = new Int8Array(2);
int8[0] = 42;
console.log(int8[0]); // 42
console.log(int8.length); // 2
console.log(int8.BYTES_PER_ELEMENT); // 1
//
var arr = new Int8Array([21, 31]);
console.log(arr[1]); // 31
//
var x = new Int8Array([21, 31]);
var y = new Int8Array(x);
console.log(y[0]); // 21
// ArrayBuffer
var buffer = new ArrayBuffer(8);
var z = new Int8Array(buffer, 1, 4);
| ECMAScript 2027 LanguageSpecification # sec-typedarray-objects |
ECMAScript 2015 (ES6) Int8Array new new Int8Array TypeError
var dv = Int8Array([1, 2, 3]);
// TypeError: calling a builtin Int8Array constructor
// without new is forbidden
var dv = new Int8Array([1, 2, 3]);
Int8ArrayTypedArrayat()TypedArray.prototype.copyWithin()TypedArray.prototype.entries()TypedArray.prototype.every()TypedArray.prototype.fill()TypedArray.prototype.filter()TypedArray.prototype.find()TypedArray.prototype.findIndex()findLast()findLastIndex()TypedArray.prototype.forEach()TypedArray.prototype.includes()TypedArray.prototype.indexOf()TypedArray.prototype.join()TypedArray.prototype.keys()TypedArray.prototype.lastIndexOf()TypedArray.prototype.map()TypedArray.prototype.reduce()TypedArray.prototype.reduceRight()TypedArray.prototype.reverse()set()slice()TypedArray.prototype.some()TypedArray.prototype.sort()TypedArray.prototype.subarray()TypedArray.prototype.toLocaleString()toReversed()TypedArray.prototype.toSorted()toString()TypedArray.prototype.values()TypedArray.prototype.with()TypedArray.prototype[Symbol.iterator]()Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()BigInt64ArrayBigUint64ArrayFloat16ArrayFloat32ArrayFloat64ArrayInt16ArrayInt32ArrayUint8ArrayUint8ClampedArrayUint16ArrayUint32Array| Web Proxy Viewer | New URL | Original Page |