new
Operatorsuper
Keyword? :
),
)if
Statementdo
-while
Statementwhile
Statementfor
Statementfor
-in
,for
-of
, andfor
-await
-of
Statementscontinue
Statementbreak
Statementreturn
Statementwith
Statementswitch
Statementthrow
Statementtry
Statementdebugger
Statement?
u
m
/
p
1-9
0
`
Arrays are
The Array
Array(…)
is equivalent to the object creation expressionnew Array(…)
with the same arguments.extends
clause of a class definition. Subclasssuper
call to the ArrayArray.prototype
methods are generic methods that are not dependent upon theirThis function performs the following steps when called:
The Array
This method performs the following steps when called:
This method is an intentionally generic factory method; it does not require that its
This function performs the following steps when called:
This method performs the following steps when called:
This method is an intentionally generic factory method; it does not require that its
The value ofArray.prototype
is the
This property has the attributes {[[Writable]]:
Array[%Symbol.species%]
is an
The value of the
Array prototype methods normally use their
TheArray prototype object:
The Array prototype object is specified to be an
This method returns an array containing the array elements of the object followed by the array elements of each argument.
It performs the following steps when called:
The
The explicit setting of the
This method is intentionally generic; it does not require that its
The abstract operation IsConcatSpreadable takes argumentO (an
The initial value ofArray.prototype.constructor
is
Theend argument is optional. If it is not provided, the length of the
Iftarget is negative, it is treated as
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method performs the following steps when called:
callback should be a function that accepts three arguments and returns a value that is coercible to a Boolean value.every
callscallback once for each element present in the array, in ascending order, until it finds one wherecallback returnsevery
immediately returnsevery
returns
If athisArg parameter is provided, it will be used as the
callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.
every
does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.
The range of elements processed byevery
is set before the first call tocallback. Elements which are appended to the array after the call toevery
begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the timeevery
visits them; elements that are deleted after the call toevery
begins and before being visited are not visited.every
acts like the "for all" quantifier in mathematics. In particular, for an empty array, it returns
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
Thestart argument is optional. If it is not provided,
Theend argument is optional. If it is not provided, the length of the
Ifstart is negative, it is treated as
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
callback should be a function that accepts three arguments and returns a value that is coercible to a Boolean value.filter
callscallback once for each element in the array, in ascending order, and constructs a new array of all the values for whichcallback returns
If athisArg parameter is provided, it will be used as the
callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.
filter
does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.
The range of elements processed byfilter
is set before the first call tocallback. Elements which are appended to the array after the call tofilter
begins will not be visited bycallback. If existing elements of the array are changed their value as passed tocallback will be the value at the timefilter
visits them; elements that are deleted after the call tofilter
begins and before being visited are not visited.
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method callspredicate once for each element of the array, in ascending index order, until it finds one wherepredicate returns a value that coerces tofind
immediately returns that element value. Otherwise,find
returns
See
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method callspredicate once for each element of the array, in ascending index order, until it finds one wherepredicate returns a value that coerces tofindIndex
immediately returns the index of that element value. Otherwise,findIndex
returns -1.
See
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method callspredicate once for each element of the array, in descending index order, until it finds one wherepredicate returns a value that coerces tofindLast
immediately returns that element value. Otherwise,findLast
returns
See
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method callspredicate once for each element of the array, in descending index order, until it finds one wherepredicate returns a value that coerces tofindLastIndex
immediately returns the index of that element value. Otherwise,findLastIndex
returns -1.
See
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
The abstract operation FindViaPredicate takes argumentsO (an Object),len (a non-negative
O should be an
predicate should be a function. When called for an element of the array, it is passed three arguments: the value of the element, the index of the element, and the object being traversed. Its return value will be coerced to a Boolean value.
thisArg will be used as the
This operation does not directly mutate the object on which it is called, but the object may be mutated by the calls topredicate.
The range of elements processed is set before the first call topredicate, just before the traversal begins. Elements that are appended to the array after this will not be visited bypredicate. If existing elements of the array are changed, their value as passed topredicate will be the value at the time that this operation visits them. Elements that are deleted after traversal begins and before being visited are still visited and are either looked up from the prototype or are
It performs the following steps when called:
This method performs the following steps when called:
The abstract operation FlattenIntoArray takes argumentstarget (an Object),source (an Object),sourceLen (a non-negative
This method performs the following steps when called:
callback should be a function that accepts three arguments.forEach
callscallback once for each element present in the array, in ascending order.callback is called only for elements of the array which actually exist; it is not called for missing elements of the array.
If athisArg parameter is provided, it will be used as the
callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.
forEach
does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.
The range of elements processed byforEach
is set before the first call tocallback. Elements which are appended to the array after the call toforEach
begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the timeforEach
visits them; elements that are deleted after the call toforEach
begins and before being visited are not visited.
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method comparessearchElement to the elements of the array, in ascending order, using the
The optional second argumentfromIndex defaults to
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method intentionally differs from the similarindexOf
method in two ways. First, it uses the
This method comparessearchElement to the elements of the array, in ascending order, using the
The optional second argumentfromIndex defaults to
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method converts the elements of the array to Strings, and then concatenates these Strings, separated by occurrences of theseparator. If no separator is provided, a single comma is used as the separator.
It performs the following steps when called:
This method is intentionally generic; it does not require that its
This method performs the following steps when called:
This method comparessearchElement to the elements of the array in descending order using the
The optional second argumentfromIndex defaults to the array's length minus one (i.e. the whole array is searched). If it is greater than or equal to the length of the array, the whole array will be searched. If it is less than
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
callback should be a function that accepts three arguments.map
callscallback once for each element in the array, in ascending order, and constructs a new Array from the results.callback is called only for elements of the array which actually exist; it is not called for missing elements of the array.
If athisArg parameter is provided, it will be used as the
callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.
map
does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.
The range of elements processed bymap
is set before the first call tocallback. Elements which are appended to the array after the call tomap
begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the timemap
visits them; elements that are deleted after the call tomap
begins and before being visited are not visited.
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method removes the last element of the array and returns it.
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method appends the arguments to the end of the array, in the order in which they appear. It returns the new length of the array.
This method performs the following steps when called:
The
This method is intentionally generic; it does not require that its
callback should be a function that takes four arguments.reduce
calls the callback, as a function, once for each element after the first element present in the array, in ascending order.
callback is called with four arguments: thepreviousValue (value from the previous call tocallback), thecurrentValue (value of the current element), thecurrentIndex, and the object being traversed. The first time that callback is called, thepreviousValue andcurrentValue can be one of two values. If aninitialValue was supplied in the call toreduce
, thenpreviousValue will beinitialValue andcurrentValue will be the first value in the array. If noinitialValue was supplied, thenpreviousValue will be the first value in the array andcurrentValue will be the second. It is a
reduce
does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.
The range of elements processed byreduce
is set before the first call tocallback. Elements that are appended to the array after the call toreduce
begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the timereduce
visits them; elements that are deleted after the call toreduce
begins and before being visited are not visited.
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
callback should be a function that takes four arguments.reduceRight
calls the callback, as a function, once for each element after the first element present in the array, in descending order.
callback is called with four arguments: thepreviousValue (value from the previous call tocallback), thecurrentValue (value of the current element), thecurrentIndex, and the object being traversed. The first time the function is called, thepreviousValue andcurrentValue can be one of two values. If aninitialValue was supplied in the call toreduceRight
, thenpreviousValue will beinitialValue andcurrentValue will be the last value in the array. If noinitialValue was supplied, thenpreviousValue will be the last value in the array andcurrentValue will be the second-to-last value. It is a
reduceRight
does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.
The range of elements processed byreduceRight
is set before the first call tocallback. Elements that are appended to the array after the call toreduceRight
begins will not be visited bycallback. If existing elements of the array are changed bycallback, their value as passed tocallback will be the value at the timereduceRight
visits them; elements that are deleted after the call toreduceRight
begins and before being visited are not visited.
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method rearranges the elements of the array so as to reverse their order. It returns the reversed array.
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method removes the first element of the array and returns it.
It performs the following steps when called:
This method is intentionally generic; it does not require that its
This method returns an array containing the elements of the array from elementstart up to, but not including, elementend (or through the end of the array ifend is
It performs the following steps when called:
The explicit setting of the
This method is intentionally generic; it does not require that its
callback should be a function that accepts three arguments and returns a value that is coercible to a Boolean value.some
callscallback once for each element present in the array, in ascending order, until it finds one wherecallback returnssome
immediately returnssome
returns
If athisArg parameter is provided, it will be used as the
callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.
some
does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.
The range of elements processed bysome
is set before the first call tocallback. Elements that are appended to the array after the call tosome
begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the time thatsome
visits them; elements that are deleted after the call tosome
begins and before being visited are not visited.some
acts like the "exists" quantifier in mathematics. In particular, for an empty array, it returns
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method sorts the elements of this array. Ifcomparator is not
It performs the following steps when called:
Because non-existent property values always compare greater than
Method calls performed by the
This method is intentionally generic; it does not require that its
The abstract operation SortIndexedProperties takes argumentsobj (an Object),len (a non-negative
Thesort order is the ordering ofitems after completion of step
Unless the
Here the notation
An abstract closure or functioncomparator is aconsistent comparator for a set of valuesS if all of the requirements below are met for all valuesa,b, andc (possibly the same value) in the setS: The notation
The above conditions are necessary and sufficient to ensure thatcomparator divides the setS into equivalence classes and that these equivalence classes are totally ordered.
The abstract operation CompareArrayElements takes argumentsx (an
This method deletes thedeleteCount elements of the array starting at
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used.
The first edition of ECMA-402 did not include a replacement specification for this method.
The meanings of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.
This method performs the following steps when called:
This method converts the elements of the array to Strings using theirtoLocaleString
methods, and then concatenates these Strings, separated by occurrences of antoString
except that it is intended to yield a locale-sensitive result corresponding with conventions of the
This method is intentionally generic; it does not require that its
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method is intentionally generic; it does not require that its
This method prepends the arguments to the start of the array, such that their order within the array is the same as the order in which they appear in the argument list.
It performs the following steps when called:
The
This method is intentionally generic; it does not require that its
This method performs the following steps when called:
This method performs the following steps when called:
The initial value of the
The initial value of the
This property has the attributes {[[Writable]]:
The ownArray.prototype
prior to the ECMAScript 2015 specification. These names are ignored forwith
statement binding purposes in order to preserve the behaviour of existing code that might use one of these names as a binding in an outer scope that is shadowed by awith
statement whose binding object is an Array.
The reason that
Array instances are
Array instances have a
The
The
Reducing the value of the
AnArray Iterator is an object that represents a specific iteration over some specific Array instance object. There is not a named
The abstract operation CreateArrayIterator takes argumentsarray (an Object) andkind (
The%ArrayIteratorPrototype% object:
The initial value of the
This property has the attributes {[[Writable]]:
Internal Slot | Type | Description |
---|---|---|
[[IteratedArrayLike]] | an Object or | The |
[[ArrayLikeNextIndex]] | a non-negative | The |
[[ArrayLikeIterationKind]] | A value that identifies what is returned for each element of the iteration. |
ATypedArray presents an array-like view of an underlying binary data buffer (
Element Type | Element Size | Conversion Operation | Description | |
---|---|---|---|---|
Int8Array %Int8Array% | 1 | 8-bit two's complement signed | ||
Uint8Array %Uint8Array% | 1 | 8-bit unsigned | ||
Uint8ClampedArray %Uint8ClampedArray% | 1 | 8-bit unsigned | ||
Int16Array %Int16Array% | 2 | 16-bit two's complement signed | ||
Uint16Array %Uint16Array% | 2 | 16-bit unsigned | ||
Int32Array %Int32Array% | 4 | 32-bit two's complement signed | ||
Uint32Array %Uint32Array% | 4 | 32-bit unsigned | ||
BigInt64Array %BigInt64Array% | 8 | 64-bit two's complement signed | ||
BigUint64Array %BigUint64Array% | 8 | 64-bit unsigned | ||
Float16Array %Float16Array% | 2 | 16-bit IEEE floating point | ||
Float32Array %Float32Array% | 4 | 32-bit IEEE floating point | ||
Float64Array %Float64Array% | 8 | 64-bit IEEE floating point |
In the definitions below, references toTypedArray should be replaced with the appropriate
The%TypedArray% intrinsic object:
super
call to it.This function performs the following steps when called:
The
The
This method performs the following steps when called:
This method performs the following steps when called:
The initial value of.prototype
is the
This property has the attributes {[[Writable]]:
[%Symbol.species%]
is an
The value of the
The%TypedArray% prototype object:
.prototype.buffer
is an
.prototype.byteLength
is an
.prototype.byteOffset
is an
The initial value of.prototype.constructor
is
The interpretation and use of the arguments of this method are the same as forArray.prototype.copyWithin
as defined in
This method performs the following steps when called:
This method performs the following steps when called:
The interpretation and use of the arguments of this method are the same as forArray.prototype.every
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.fill
as defined in
This method performs the following steps when called:
The interpretation and use of the arguments of this method are the same as forArray.prototype.filter
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.find
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.findIndex
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.findLast
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.findLastIndex
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.forEach
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.includes
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.indexOf
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.join
as defined in
This method performs the following steps when called:
This method is not generic. The
This method performs the following steps when called:
The interpretation and use of the arguments of this method are the same as forArray.prototype.lastIndexOf
as defined in
This method performs the following steps when called:
This method is not generic. The
.prototype.length
is an
This function is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.map
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.reduce
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.reduceRight
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.reverse
as defined in
This method performs the following steps when called:
This method is not generic. The
This method sets multiple values in thisTypedArray, reading the values fromsource. The details differ based upon the type ofsource. The optionaloffset value indicates the first element index in thisTypedArray where values are written. If omitted, it is assumed to be 0.
It performs the following steps when called:
This method is not generic. The
The abstract operation SetTypedArrayFromArrayLike takes argumentstarget (a
The abstract operation SetTypedArrayFromTypedArray takes argumentstarget (a
The interpretation and use of the arguments of this method are the same as forArray.prototype.slice
as defined in
This method performs the following steps when called:
This method is not generic. The
The interpretation and use of the arguments of this method are the same as forArray.prototype.some
as defined in
This method performs the following steps when called:
This method is not generic. The
This is a distinct method that, except as described below, implements the same requirements as those ofArray.prototype.sort
as defined in
This method is not generic. The
It performs the following steps when called:
Because
This method returns a newTypedArray whose element type is the element type of thisTypedArray and whose ArrayBuffer is the ArrayBuffer of thisTypedArray, referencing the elements in the
It performs the following steps when called:
This method is not generic. The
This is a distinct method that implements the same algorithm asArray.prototype.toLocaleString
as defined in
This method is not generic.
If the ECMAScript implementation includes the ECMA-402 Internationalization API this method is based upon the algorithm forArray.prototype.toLocaleString
that is in the ECMA-402 specification.
This method performs the following steps when called:
This method performs the following steps when called:
The initial value of the
This method performs the following steps when called:
This method performs the following steps when called:
The initial value of the
.prototype[%Symbol.toStringTag%]
is an
This property has the attributes {[[Enumerable]]:
The initial value of the
The abstract operation TypedArrayCreateFromConstructor takes argumentsconstructor (a
The abstract operation TypedArrayCreateSameType takes argumentsexemplar (a
The abstract operation TypedArraySpeciesCreate takes argumentsexemplar (a
The abstract operation ValidateTypedArray takes argumentsO (an
The abstract operation TypedArrayElementSize takes argumentO (a
The abstract operation TypedArrayElementType takes argumentO (a
The abstract operation CompareTypedArrayElements takes argumentsx (a Number or a BigInt),y (a Number or a BigInt), andcomparator (a
EachTypedArray
extends
clause of a class definition. Subclasssuper
call to theTypedArray.prototype
built-in methods.EachTypedArray
"%TypedArray.prototype%"
.The abstract operation AllocateTypedArray takes argumentsconstructorName (a String which is the name of a
The abstract operation InitializeTypedArrayFromTypedArray takes argumentsO (a
The abstract operation InitializeTypedArrayFromArrayBuffer takes argumentsO (a
The abstract operation InitializeTypedArrayFromList takes argumentsO (a
The abstract operation InitializeTypedArrayFromArrayLike takes argumentsO (a
The abstract operation AllocateTypedArrayBuffer takes argumentsO (a
EachTypedArray
The value ofTypedArray.BYTES_PER_ELEMENT
is the Element Size value specified in
This property has the attributes {[[Writable]]:
The initial value ofTypedArray.prototype
is the correspondingTypedArray prototype intrinsic object (
This property has the attributes {[[Writable]]:
EachTypedArray prototype object:
The value ofTypedArray.prototype.BYTES_PER_ELEMENT
is the Element Size value specified in
This property has the attributes {[[Writable]]:
The initial value of the
TypedArray instances are
A Uint8Array is a particular kind ofTypedArray as described above. In addition, there are additional methods on the Uint8Array
The abstract operation ValidateUint8Array takes argumentta (an
The abstract operation GetUint8ArrayBytes takes argumentta (a Uint8Array) and returns either a
The abstract operation SetUint8ArrayBytes takes argumentsinto (a Uint8Array) andbytes (a
The abstract operation SkipAsciiWhitespace takes argumentsstring (a String) andindex (a non-negative
The abstract operation DecodeFinalBase64Chunk takes argumentschunk (a String of length 2 or 3) andthrowOnExtraBits (a Boolean) and returns either a
The abstract operation DecodeFullLengthBase64Chunk takes argumentchunk (a String of length 4) and returns a
Thestandard base64 alphabet is
The abstract operation FromBase64 takes argumentsstring (a String),alphabet (
The abstract operation FromHex takes argumentstring (a String) and optional argumentmaxLength (a non-negative