Float32Array
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ì.
Float32Array íìí ë°°ì´(TypedArray)ì íë«í¼ì ë°ì´í¸ ìì를 ë°ë¥´ë 32ë¹í¸ ë¶ë ììì ë°°ì´ì
ëë¤. ë°ì´í¸ ìì를 ì ì´í´ì¼ íë ê²½ì° ëì DataView를 ì¬ì©íì기 ë°ëëë¤. ëª
ìì ì¼ë¡ ì´ê¸°í ë°ì´í°ë¥¼ ì ê³µíì§ ìì¼ë©´ ë°°ì´ì ë´ì©ì 0ì¼ë¡ ì´ê¸°íë©ëë¤. ë°°ì´ì´ ìì±ëë©´ ê°ì²´ì ë©ìë를 ì¬ì©íê±°ë íì¤ ë°°ì´ ì¸ë±ì¤ 구문(ì¦, ëê´í¸ íê¸°ë² ì¬ì©)ì ì¬ì©íì¬ ë°°ì´ì ìì를 참조í ì ììµëë¤.
ìì±ì
Float32Array()-
ìë¡ì´
Float32Arrayê°ì²´ë¥¼ ìì±í©ëë¤.
ì ì ìì±
ë¶ëª¨ TypedArrayìì ì ì ìì±ì ììí©ëë¤.
Float32Array.BYTES_PER_ELEMENT-
ìì í¬ê¸°ë¥¼ ì«ì ê°ì¼ë¡ ë°íí©ëë¤.
Float32Arrayì ê²½ì°4ì ëë¤.
ì ì ë©ìë
ë¶ëª¨ TypedArrayìì ì ì ë©ìë를 ììí©ëë¤.
ì¸ì¤í´ì¤ ìì±
ë¶ëª¨ TypedArrayìì ì¸ì¤í´ì¤ ìì±ì ììí©ëë¤.
Float32Array.prototype.BYTES_PER_ELEMENT-
ìì í¬ê¸°ë¥¼ ì«ì ê°ì¼ë¡ ë°íí©ëë¤.
Float32Arrayì ê²½ì°4ì ëë¤. Float32Array.prototype.constructor-
ì¸ì¤í´ì¤ ê°ì²´ë¥¼ ìì±í ìì±ì í¨ìì ëë¤.
Float32Arrayì¸ì¤í´ì¤ì ê²½ì° ì´ê¸° ê°ìFloat32Arrayìì±ì ì ëë¤.
ì¸ì¤í´ì¤ ë©ìë
ë¶ëª¨ TypedArrayìì ì¸ì¤í´ì¤ ë©ìë를 ììí©ëë¤.
ìì
>Float32Array를 ìì±í기 ìí ê°ê¸° ë¤ë¥¸ ì¬ë¬ ë°©ë²
// 길ì´ë¡ë¶í° ìì±
const float32 = new Float32Array(2);
float32[0] = 42;
console.log(float32[0]); // 42
console.log(float32.length); // 2
console.log(float32.BYTES_PER_ELEMENT); // 4
// ë°°ì´ë¡ë¶í° ìì±
const x = new Float32Array([21, 31]);
console.log(x[1]); // 31
// ë¤ë¥¸ TypedArrayë¡ë¶í° ìì±
const y = new Float32Array(x);
console.log(y[0]); // 21
// ArrayBufferë¡ë¶í° ìì±
const buffer = new ArrayBuffer(32);
const z = new Float32Array(buffer, 4, 4);
console.log(z.byteOffset); // 4
// ìíë¡ë¶í° ìì±
const iterable = (function* () {
yield* [1, 2, 3];
})();
const float32FromIterable = new Float32Array(iterable);
console.log(float32FromIterable);
// Float32Array [1, 2, 3]
ëª ì¸ì
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-typedarray-objects> |