| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#syntax | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..
TypedArray ( ) (ArrayBuffer). TypedArray, TypedArray. , . . , .
new TypedArray(); // ES2017 new TypedArray(length); new TypedArray(typedArray); new TypedArray(object); new TypedArray(buffer [, byteOffset [, length]]); TypedArray() : Int8Array(), Uint8Array(), Uint8ClampedArray(), Int16Array(), Uint16Array(), Int32Array(), Uint32Array(), Float32Array(), Float64Array()
length BYTES_PER_ELEMENT ,
typedArray, (, Int32Array), typedArray . typedArray . typedArray typedArray
, TypedArray.from()
buffer byteOffset length, , buffer ArrayBuffer. byteOffset length () , . (byteOffset length) , buffer; length, , byteOffset.
ECMAScript 2015 TypedArray, TypedArray-. : - %TypedArray% TypedArray . Object.getPrototypeOf(...) (, Int8Array.prototype). TypedArrays %TypedArray%. , (TypedArray.prototype) %TypedArray%.prototype.
%TypedArray% . new TypeError, , JS-, . , %TypedArray% () TypedArray.
TypedArray (, Int8Array), , ArrayBuffer , . , %TypedArray%.prototype, , , .
(, arr[12]). , , . ArrayBuffer . .
//
var int16 = new Int16Array(2);
int16[0] = 42;
console.log(int16[0]); // 42
// ( 20 "foo")
Int8Array.prototype[20] = "foo";
new Int8Array(32)[20]; // 0
//
Int8Array.prototype[20] = "foo";
new Int8Array(8)[20]; // undefined
//
Int8Array.prototype[-1] = "foo";
new Int8Array(8)[-1]; // undefined
//
Int8Array.prototype.foo = "bar";
new Int8Array(32).foo; // "bar"
| () | Web IDL | C | |||
|---|---|---|---|---|---|
Int8Array |
-128 127 | 1 | 8- | byte |
int8_t |
Uint8Array |
0 255 | 1 | 8- | octet |
uint8_t |
Uint8ClampedArray |
0 255 | 1 | 8- ( 0 255) | octet |
uint8_t |
Int16Array |
-32768 32767 | 2 | 16- | short |
int16_t |
Uint16Array |
0 65535 | 2 | 16- | unsigned short |
uint16_t |
Int32Array |
-2147483648 2147483647 | 4 | 32- | long |
int32_t |
Uint32Array |
0 4294967295 | 4 | 32- | unsigned long |
uint32_t |
Float32Array |
1.2x10-38 to 3.4x1038 | 4 | 32- IEEE- (7 , 1.123456) | unrestricted float |
float |
Float64Array |
5.0x10-324 to 1.8x10308 | 8 | 64- IEEE- (16 , , 1.123...15) | unrestricted double |
double |
TypedArray.BYTES_PER_ELEMENT.
"", 0.
TypedArray.name. , "Int8Array".
get TypedArray[@@species]. .
TypedArrayTypedArray-.
TypedArrays- TypedArray.
, TypedArray, , , Arrays. Javascript- , Typed Array.
var typedArrayTypes = [
Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array,
];
for (var k in typedArrayTypes)
for (var v in Array.prototype)
if (
Array.prototype.hasOwnProperty(v) &&
!typedArrayTypes[k].prototype.hasOwnProperty(v)
)
typedArrayTypes[k].prototype[v] = Array.prototype[v];
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-typedarray-objects |
This page was last modified on 29 . 2026 . by MDN contributors.
TypedArrayat()copyWithin()entries()every()fill()filter()find()findIndex()findLast()findLastIndex()forEach()includes()indexOf()TypedArray.prototype.join()keys()lastIndexOf()map()reduce()reduceRight()reverse()TypedArray.prototype.set()slice()some()sort()subarray()toLocaleString()toReversed()toSorted()toString()values()with()[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()BigInt64ArrayBigUint64ArrayFloat16ArrayFloat32ArrayFloat64ArrayInt8ArrayInt16ArrayInt32ArrayUint8ArrayUint8ClampedArrayUint16ArrayUint32ArrayYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |