Uint8Array
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since â¨2015ë 7ìâ©.
* Some parts of this feature may have varying levels of support.
Uint8Array íìí ë°°ì´(TypedArray)ì íë«í¼ì ë°ì´í¸ ìì를 ë°ë¥´ë 8ë¹í¸ ë¶í¸ ìë ì ìì ë°°ì´ì ëíë
ëë¤.
ë°°ì´ì ë´ì©ì 0ì¼ë¡ ì´ê¸°íë©ëë¤.
ë°°ì´ì´ ìì±ëë©´ ê°ì²´ì ë©ìë를 ì¬ì©íê±°ë íì¤ ë°°ì´ ì¸ë±ì¤ 구문(ì¦, ëê´í¸ íê¸°ë² ì¬ì©)ì ì¬ì©íì¬ ë°°ì´ì ìì를 참조í ì ììµëë¤.
ìì±ì
Uint8Array()-
ìë¡ì´
Uint8Arrayê°ì²´ë¥¼ ìì±í©ëë¤.
ì ì ìì±
ë¶ëª¨ TypedArrayìì ì ì ìì±ì ììí©ëë¤.
Uint8Array.BYTES_PER_ELEMENT-
ìì í¬ê¸°ë¥¼ ì«ì ê°ì¼ë¡ ë°íí©ëë¤.
Uint8Arrayì ê²½ì°1ì ëë¤. Uint8Array.name-
ìì±ì ì´ë¦ì 문ìì´ë¡ ë°íí©ëë¤.
Uint8Arrayíì ì ê²½ì°"Uint8Array"ì ëë¤.
ì ì ë©ìë
ë¶ëª¨ TypedArrayìì ì ì ë©ìë를 ììí©ëë¤.
ì¸ì¤í´ì¤ ìì±
ë¶ëª¨ TypedArrayìì ì¸ì¤í´ì¤ ìì±ì ììí©ëë¤.
Uint8Array.prototype.BYTES_PER_ELEMENT-
ìì í¬ê¸°ë¥¼ ì«ì ê°ì¼ë¡ ë°íí©ëë¤.
Uint8Arrayì ê²½ì°1ì ëë¤.
ì¸ì¤í´ì¤ ë©ìë
ë¶ëª¨ TypedArrayìì ì¸ì¤í´ì¤ ë©ìë를 ììí©ëë¤.
ìì
>Uint8Arrayì ìì±í기 ìí ê°ê¸° ë¤ë¥¸ ì¬ë¬ ë°©ë²
// 길ì´ë¡ë¶í° ìì±
const uint8 = new Uint8Array(2);
uint8[0] = 42;
console.log(uint8[0]); // 42
console.log(uint8.length); // 2
console.log(uint8.BYTES_PER_ELEMENT); // 1
// ë°°ì´ë¡ë¶í°
const x = new Uint8Array([21, 31]);
console.log(x[1]); // 31
// ë¤ë¥¸ TypedArrayë¡ë¶í°
const y = new Uint8Array(x);
console.log(y[0]); // 21
// ArrayBufferë¡ë¶í°
const buffer = new ArrayBuffer(8);
const z = new Uint8Array(buffer, 1, 4);
console.log(z.byteOffset); // 1
// ìíë¡ë¶í°
const iterable = (function* () {
yield* [1, 2, 3];
})();
const uint8FromIterable = new Uint8Array(iterable);
console.log(uint8FromIterable);
// Uint8Array [1, 2, 3]
ëª ì¸ì
| Specification |
|---|
| ECMAScript® 2026 Language Specification > # sec-typedarray-objects > |