| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Int8Array | [Back] [Original] |
Get to know MDN better
Int8Array() Int8Array
Int8Array.BYTES_PER_ELEMENTInt8Array 1
Int8Array.prototype Int8Array
Int8Array.prototype.BYTES_PER_ELEMENTInt8Array 2
Int8Array.prototype.constructor Int8Array Int8Array
//
const int8 = new Int8Array(2);
int8[0] = 42;
console.log(int8[0]); // 42
console.log(int8.length); // 2
console.log(int8.BYTES_PER_ELEMENT); // 1
//
const x = new Int8Array([21, 31]);
console.log(x[1]); // 31
// TypedArray
const y = new Int8Array(x);
console.log(y[0]); // 21
// ArrayBuffer
const buffer = new ArrayBuffer(8);
const z = new Int8Array(buffer, 1, 4);
console.log(z.byteOffset); // 1
//
const iterable = (function* () {
yield* [1, 2, 3];
})();
const int8FromIterable = new Int8Array(iterable);
console.log(int8FromIterable);
// Int8Array [1, 2, 3]
| ECMAScript 2027 LanguageSpecification # sec-typedarray-objects |
| Web Proxy Viewer | New URL | Original Page |