Czytasz angielską wersję tego artykułu, ponieważ nie ma jeszcze tłumaczenia dla tego języka. Pomóż nam przetłumaczyć ten artykuł!
A TypedArray object describes an array-like view of an underlying binary data buffer. There is no global property named TypedArray
, nor is there a directly visible TypedArray
constructor. Instead, there are a number of different global properties, whose values are typed array constructors for specific element types, listed below. On the following pages you will find common properties and methods that can be used with any typed array containing elements of any type.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
new TypedArray(); // new in ES2017 new TypedArray(length); new TypedArray(typedArray); new TypedArray(object); new TypedArray(buffer [, byteOffset [, length]]); // where TypedArray() is one of: Int8Array(); Uint8Array(); Uint8ClampedArray(); Int16Array(); Uint16Array(); Int32Array(); Uint32Array(); Float32Array(); Float64Array(); BigInt64Array(); BigUint64Array();
Parameters
- length
- When called with a
length
argument, an internal array buffer is created in memory, of size length multiplied by BYTES_PER_ELEMENT bytes, containing zeros. - typedArray
- When called with a
typedArray
argument, which can be an object of any of the typed array types (such asInt32Array
), thetypedArray
gets copied into a new typed array. Each value intypedArray
is converted to the corresponding type of the constructor before being copied into the new array. The length of the new typed array will be same as the length of thetypedArray
argument. - object
- When called with an
object
argument, a new typed array is created as if by theTypedArray.from()
method. - buffer, byteOffset, length
- When called with a
buffer
, and optionally abyteOffset
and alength
argument, a new typed array view is created that views the specifiedArrayBuffer
. ThebyteOffset
andlength
parameters specify the memory range that will be exposed by the typed array view. If both are omitted, all ofbuffer
is viewed; if onlylength
is omitted, the remainder ofbuffer
is viewed.
Description
ECMAScript 2015 defines a TypedArray constructor that serves as the [[Prototype]]
of all TypedArray constructors. This constructor is not directly exposed: there is no global %TypedArray%
or TypedArray
property. It is only directly accessible through Object.getPrototypeOf(Int8Array)
and similar. All TypedArrays constructors inherit common properties from the %TypedArray%
constructor function. Additionally, all typed array prototypes (TypedArray.prototype
) have %TypedArray%.prototype
as their [[Prototype]]
.
The %TypedArray%
constructor on its own is not particularly useful. Calling it or using it in a new
expression will throw a TypeError
, except when used during object creation in JS engines that support subclassing. There are at present no such engines, so %TypedArray%
is only useful to polyfill functions or properties onto all TypedArray constructors.
When creating an instance of a TypedArray (e.g. Int8Array
), an array buffer is created internally in memory or, if an ArrayBuffer
object is given as constructor argument, then this is used instead. The buffer address is saved as an internal property of the instance and all the methods of %TypedArray
%.prototype
, i.e. set value and get value etc., operate on that array buffer address.
Property access
You can reference elements in the array using standard array index syntax (that is, using bracket notation). However, getting or setting indexed properties on typed arrays will not search in the prototype chain for this property, even when the indices are out of bound. Indexed properties will consult the ArrayBuffer
and will never look at object properties. You can still use named properties, just like with all objects.
// Setting and getting using standard array syntax var int16 = new Int16Array(2); int16[0] = 42; console.log(int16[0]); // 42 // Indexed properties on prototypes are not consulted (Fx 25) Int8Array.prototype[20] = 'foo'; (new Int8Array(32))[20]; // 0 // even when out of bound Int8Array.prototype[20] = 'foo'; (new Int8Array(8))[20]; // undefined // or with negative integers Int8Array.prototype[-1] = 'foo'; (new Int8Array(8))[-1]; // undefined // Named properties are allowed, though (Fx 30) Int8Array.prototype.foo = 'bar'; (new Int8Array(32)).foo; // "bar"
TypedArray objects
Type | Value Range | Size in bytes | Description | Web IDL type | Equivalent C type |
Int8Array |
-128 to 127 | 1 | 8-bit two's complement signed integer | byte |
int8_t |
Uint8Array |
0 to 255 | 1 | 8-bit unsigned integer | octet |
uint8_t |
Uint8ClampedArray |
0 to 255 | 1 | 8-bit unsigned integer (clamped) | octet |
uint8_t |
Int16Array |
-32768 to 32767 | 2 | 16-bit two's complement signed integer | short |
int16_t |
Uint16Array |
0 to 65535 | 2 | 16-bit unsigned integer | unsigned short |
uint16_t |
Int32Array |
-2147483648 to 2147483647 | 4 | 32-bit two's complement signed integer | long |
int32_t |
Uint32Array |
0 to 4294967295 | 4 | 32-bit unsigned integer | unsigned long |
uint32_t |
Float32Array |
1.2x10-38 to 3.4x1038 | 4 | 32-bit IEEE floating point number ( 7 significant digits e.g. 1.1234567) | unrestricted float |
float |
Float64Array |
5.0x10-324 to 1.8x10308 | 8 | 64-bit IEEE floating point number (16 significant digits e.g. 1.123...15) | unrestricted double |
double |
BigInt64Array |
-263 to 263-1 | 8 | 64-bit two's complement signed integer | bigint |
int64_t (signed long long) |
BigUint64Array |
0 to 264-1 | 8 | 64-bit unsigned integer | bigint |
uint64_t (unsigned long long) |
Properties
TypedArray.BYTES_PER_ELEMENT
- Returns a number value of the element size for the different typed array objects.
- TypedArray.length
- Length property whose value is 3.
TypedArray.name
- Returns the string value of the constructor name. E.g "Int8Array".
get TypedArray[@@species]
- The constructor function that is used to create derived objects.
TypedArray.prototype
- Prototype for the TypedArray objects.
Methods
TypedArray.from()
- Creates a new typed array from an array-like or iterable object. See also
Array.from()
. TypedArray.of()
- Creates a new typed array with a variable number of arguments. See also
Array.of()
.
TypedArray prototype
All TypedArrays inherit from TypedArray.prototype
.
Properties
TypedArray.prototype.constructor
- Returns the function that created an instance's prototype. This is one the corresponding typed array type functions by default.
TypedArray.prototype.buffer
Read only- Returns the
ArrayBuffer
referenced by the typed array. Fixed at construction time and thus read only. TypedArray.prototype.byteLength
Read only- Returns the length (in bytes) of the typed array. Fixed at construction time and thus read only.
TypedArray.prototype.byteOffset
Read only- Returns the offset (in bytes) of the typed array from the start of its
ArrayBuffer
. Fixed at construction time and thus read only. TypedArray.prototype.length
Read only- Returns the number of elements held in the typed array. Fixed at construction time and thus read only.
Methods
TypedArray.prototype.copyWithin()
- Copies a sequence of array elements within the array. See also
Array.prototype.copyWithin()
. TypedArray.prototype.entries()
- Returns a new
Array Iterator
object that contains the key/value pairs for each index in the array. See alsoArray.prototype.entries()
. TypedArray.prototype.every()
- Tests whether all elements in the array pass the test provided by a function. See also
Array.prototype.every()
. TypedArray.prototype.fill()
- Fills all the elements of an array from a start index to an end index with a static value. See also
Array.prototype.fill()
. TypedArray.prototype.filter()
- Creates a new array with all of the elements of this array for which the provided filtering function returns true. See also
Array.prototype.filter()
. TypedArray.prototype.find()
- Returns the found value in the array, if an element in the array satisfies the provided testing function or
undefined
if not found. See alsoArray.prototype.find()
. TypedArray.prototype.findIndex()
- Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. See also
Array.prototype.findIndex()
. TypedArray.prototype.forEach()
- Calls a function for each element in the array. See also
Array.prototype.forEach()
. TypedArray.prototype.includes()
- Determines whether a typed array includes a certain element, returning
true
orfalse
as appropriate. See alsoArray.prototype.includes()
. TypedArray.prototype.indexOf()
- Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. See also
Array.prototype.indexOf()
. TypedArray.prototype.join()
- Joins all elements of an array into a string. See also
Array.prototype.join()
. TypedArray.prototype.keys()
- Returns a new
Array Iterator
that contains the keys for each index in the array. See alsoArray.prototype.keys()
. TypedArray.prototype.lastIndexOf()
- Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. See also
Array.prototype.lastIndexOf()
. TypedArray.prototype.map()
- Creates a new array with the results of calling a provided function on every element in this array. See also
Array.prototype.map()
. TypedArray.prototype.move()
Unimplemented- Former non-standard version of
TypedArray.prototype.copyWithin()
. TypedArray.prototype.reduce()
- Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. See also
Array.prototype.reduce()
. TypedArray.prototype.reduceRight()
- Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. See also
Array.prototype.reduceRight()
. TypedArray.prototype.reverse()
- Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. See also
Array.prototype.reverse()
. TypedArray.prototype.set()
- Stores multiple values in the typed array, reading input values from a specified array.
TypedArray.prototype.slice()
- Extracts a section of an array and returns a new array. See also
Array.prototype.slice()
. TypedArray.prototype.some()
- Returns true if at least one element in this array satisfies the provided testing function. See also
Array.prototype.some()
. TypedArray.prototype.sort()
- Sorts the elements of an array in place and returns the array. See also
Array.prototype.sort()
. TypedArray.prototype.subarray()
- Returns a new TypedArray from the given start and end element index.
TypedArray.prototype.values()
- Returns a new
Array Iterator
object that contains the values for each index in the array. See alsoArray.prototype.values()
. TypedArray.prototype.toLocaleString()
- Returns a localized string representing the array and its elements. See also
Array.prototype.toLocaleString()
. TypedArray.prototype.toString()
- Returns a string representing the array and its elements. See also
Array.prototype.toString()
. TypedArray.prototype[@@iterator]()
- Returns a new
Array Iterator
object that contains the values for each index in the array.
Methods Polyfill
Many of the methods used in Typed Arrays can be polyfilled using the methods present in regular Javascript Arrays. The following snippet of JavaScript demonstrates how you might polyfill any missing Typed Array methods.
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];
Specifications
Specification | Status | Comment |
---|---|---|
Typed Array Specification | Obsolete | Defined as TypedArray and ArrayBufferView interface with typed array view types. Superseded by ECMAScript 2015. |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'TypedArray Objects' in that specification. |
Standard | Initial definition in an ECMA standard. Specified behaviour for indexed and named properties. Specified that new is required. |
ECMAScript Latest Draft (ECMA-262) The definition of 'TypedArray Objects' in that specification. |
Draft | ECMAScript 2017 changed the TypedArray constructor to use the ToIndex operation and allows constructors with no arguments. |
Browser compatibility
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TypedArray | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs Full support Yes |
BYTES_PER_ELEMENT | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs Full support Yes |
buffer | Chrome Full support 7 | Edge Full support 14 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs Full support Yes |
byteLength | Chrome Full support 7 | Edge Full support 14 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs Full support Yes |
byteOffset | Chrome Full support 7 | Edge Full support 14 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs Full support Yes |
Constructor without arguments | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 55 | IE Full support 10 | Opera Full support Yes | Safari Full support 5.1 | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 55 | Opera Android Full support Yes | Safari iOS Full support 5 | Samsung Internet Android Full support 1.0 | nodejs ? |
copyWithin | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 34 | IE No support No | Opera Full support 36 | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 34 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 4.0.0 |
entries | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 36 | Safari No support No | WebView Android No support No | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android Full support Yes | nodejs Full support 0.12 |
every | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 36 | Safari No support No | WebView Android No support No | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android Full support Yes | nodejs Full support 4.0.0 |
fill | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 36 | Safari No support No | WebView Android No support No | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android Full support Yes | nodejs Full support 4.0.0 |
filter | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 38 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android Full support 45 | Firefox Android Full support 38 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android Full support Yes | nodejs Full support 4.0.0 |
find | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 32 | Safari No support No | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android Full support 32 | Safari iOS No support No | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
findIndex | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 32 | Safari No support No | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android Full support 32 | Safari iOS No support No | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
forEach | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 38 | IE No support No | Opera Full support 32 | Safari Full support 10 | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 38 | Opera Android Full support 32 | Safari iOS ? | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
from | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 38 | IE No support No | Opera No support No | Safari Full support 10 | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 38 | Opera Android No support No | Safari iOS Full support 10 | Samsung Internet Android No support No | nodejs Full support 4.0.0 |
includes | Chrome Full support 47 | Edge Full support 14 | Firefox Full support 43 | IE No support No | Opera Full support 34 | Safari Full support 10 | WebView Android No support No | Chrome Android Full support 47 | Firefox Android Full support 43 | Opera Android Full support 34 | Safari iOS Full support 10 | Samsung Internet Android Full support 5.0 | nodejs
Full support
6.0.0
|
Indexed properties not consulting prototype | Chrome
Full support
7
| Edge
Full support
12
| Firefox Full support 25 | IE
Full support
10
| Opera
Full support
Yes
| Safari
Full support
5.1
| WebView Android
Full support
≤37
| Chrome Android
Full support
18
| Firefox Android Full support 25 | Opera Android
Full support
Yes
| Safari iOS
Full support
5
| Samsung Internet Android
Full support
1.0
| nodejs
?
|
indexOf | Chrome Full support 45 | Edge Full support 14 | Firefox
Full support
37
| IE No support No | Opera Full support 32 | Safari No support No | WebView Android No support No | Chrome Android Full support 45 | Firefox Android
Full support
37
| Opera Android Full support 32 | Safari iOS No support No | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
Iterable in constructor | Chrome Full support 39 | Edge Full support 14 | Firefox Full support 52 | IE No support No | Opera Full support 26 | Safari ? | WebView Android Full support 39 | Chrome Android Full support 39 | Firefox Android Full support 52 | Opera Android Full support 26 | Safari iOS ? | Samsung Internet Android Full support 4.0 | nodejs Full support 4.0.0 |
join | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 32 | Safari No support No | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android Full support 32 | Safari iOS No support No | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
keys | Chrome Full support 38 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 25 | Safari Full support 10 | WebView Android Full support 38 | Chrome Android Full support 38 | Firefox Android Full support 37 | Opera Android Full support 25 | Safari iOS Full support 10 | Samsung Internet Android Full support 3.0 | nodejs Full support 0.12 |
lastIndexOf | Chrome Full support 45 | Edge Full support 14 | Firefox
Full support
37
| IE No support No | Opera Full support 32 | Safari Full support 10 | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android
Full support
37
| Opera Android Full support 32 | Safari iOS Full support 10 | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
length | Chrome Full support 7 | Edge Full support 14 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs Full support Yes |
map | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 38 | IE No support No | Opera Full support 32 | Safari No support No | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 38 | Opera Android Full support 32 | Safari iOS No support No | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
move | Chrome No support No | Edge No support No | Firefox
No support
16 — 34
| IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android
No support
16 — 34
| Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs No support No |
name | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs Full support Yes |
Named properties | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 30 | IE Full support 10 | Opera Full support Yes | Safari Full support 5.1 | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 30 | Opera Android Full support Yes | Safari iOS Full support 5 | Samsung Internet Android Full support 1.0 | nodejs ? |
TypedArray() without new throws | Chrome Full support 7 | Edge Full support 14 | Firefox Full support 44 | IE No support No | Opera Full support Yes | Safari Full support 5.1 | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 44 | Opera Android Full support Yes | Safari iOS Full support 5 | Samsung Internet Android Full support 1.0 | nodejs Full support 0.12 |
of | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 38 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 38 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 4.0.0 |
prototype | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs Full support Yes |
reduce | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 32 | Safari Full support 10 | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android No support No | Safari iOS Full support 10 | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
reduceRight | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 32 | Safari Full support 10 | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android No support No | Safari iOS Full support 10 | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
reverse | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 32 | Safari Full support 10 | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android No support No | Safari iOS Full support 10 | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
set | Chrome Full support 7 | Edge Full support 14 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs ? |
slice | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 38 | IE No support No | Opera Full support 32 | Safari ? | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 38 | Opera Android ? | Safari iOS ? | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
some | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 32 | Safari Full support 10 | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 37 | Opera Android No support No | Safari iOS Full support 10 | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
sort | Chrome Full support 45 | Edge Full support 14 | Firefox Full support 46 | IE No support No | Opera Full support 32 | Safari ? | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android Full support 46 | Opera Android Full support 32 | Safari iOS ? | Samsung Internet Android Full support 5.0 | nodejs Full support 4.0.0 |
subarray | Chrome Full support 7 | Edge Full support 14 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support Yes | nodejs Full support 0.12 |
toLocaleString | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 51 | IE Full support 10 | Opera Full support Yes | Safari Full support 5.1 | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 51 | Opera Android Full support Yes | Safari iOS Full support 5 | Samsung Internet Android Full support 1.0 | nodejs ? |
toString | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 51 | IE Full support 10 | Opera Full support Yes | Safari Full support 5.1 | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 51 | Opera Android Full support Yes | Safari iOS Full support 5 | Samsung Internet Android Full support 1.0 | nodejs ? |
values | Chrome Full support 38 | Edge Full support 14 | Firefox Full support 37 | IE No support No | Opera Full support 25 | Safari Full support 10 | WebView Android Full support 38 | Chrome Android Full support 38 | Firefox Android Full support 37 | Opera Android Full support 25 | Safari iOS Full support 10 | Samsung Internet Android Full support 3.0 | nodejs Full support 0.12 |
@@iterator | Chrome Full support 38 | Edge Full support 12 | Firefox
Full support
36
| IE No support No | Opera Full support 25 | Safari Full support Yes | WebView Android Full support 38 | Chrome Android Full support 38 | Firefox Android
Full support
36
| Opera Android Full support 25 | Safari iOS Full support Yes | Samsung Internet Android Full support 3.0 | nodejs Full support 0.12 |
@@species | Chrome Full support 51 | Edge Full support 13 | Firefox Full support 48 | IE No support No | Opera Full support 38 | Safari ? | WebView Android Full support 51 | Chrome Android Full support 51 | Firefox Android Full support 48 | Opera Android Full support 41 | Safari iOS ? | Samsung Internet Android Full support 5.0 | nodejs
Full support
6.5.0
|
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.
- See implementation notes.
- See implementation notes.
- User must explicitly enable this feature.
- User must explicitly enable this feature.
- Uses a non-standard name.
- Uses a non-standard name.
Compatibility notes
Starting with ECMAScript 2015, TypedArray
constructors require to be constructed with a new
operator. Calling a TypedArray
constructor as a function without new
, will throw a TypeError
from now on.
var dv = Int8Array([1, 2, 3]); // TypeError: calling a builtin Int8Array constructor // without new is forbidden
var dv = new Int8Array([1, 2, 3]);