[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Int8Array [Back]  [Original]

Int8Array - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Int8Array

Baseline

20157

Int8Array 2 8 0

Int8Array TypedArray

Int8Array()

Int8Array

TypedArray

Int8Array.BYTES_PER_ELEMENT

Int8Array 1

TypedArray

TypedArray

Int8Array.prototype Int8Array

Int8Array.prototype.BYTES_PER_ELEMENT

Int8Array 2

Int8Array.prototype.constructor

Int8Array Int8Array

TypedArray

Int8Array

js
// 
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