?
u
/
ECMAScript is object-based: basic language and and Symbol,
ECMAScript defines a collection of built-in objects that round
out the definition of ECMAScript entities. These built-in objects include
the Object
, Function
, Boolean
, Symbol
,
Record
, Tuple
, and various Error
objects; objects that
represent and manipulate numeric values including Math
, Number
, and
Date
; the text processing objects String
and RegExp
; objects that
are indexed collections of values including Array
and nine different
kinds of Typed Arrays whose elements all have a specific numeric data
representation; keyed collections including Map
and Set
objects;
objects supporting structured data including the JSON
object,
ArrayBuffer
, SharedArrayBuffer
, and DataView
; objects supporting
control abstractions including generator functions and Promise
objects;
and reflection objects including Proxy
and Reflect
.
primitive value which is a mapping from Strings to ECMAScript primitive values
a
set of all
member of the Object type that is an instance of the standard built-in
Record
A Object
function in a call
expression, supplying a Record
primitive value which is an ordered sequence of ECMAScript primitive values
a Tuple value is completely immutable and will not change over time
set of all Tuple values
member of the Object type that is an instance of the standard built-in
Tuple
A Tuple object is created by using the Object
function in a call
expression, supplying a Tuple value as an argument. The resulting
object has an internal slot whose value is the Tuple value.
The Record type is the set of all finite mappings from Strings to ECMAScript primitive values including
The abstract operation RecordToString takes argument argument (a
The abstract operation StringifyRecordValue takes argument value (a primitive value) and returns a String. It performs the following steps when called:
The abstract operation RecordEqual takes arguments x (a
The abstract operation RecordSameValue takes arguments x (a
The abstract operation RecordSameValueZero takes arguments x (a
The Tuple type is the set of all finite and ordered sequences of ECMAScript primitive values including
The abstract operation TupleToString takes argument argument (a Tuple) and returns a String. It converts argument to a String. It performs the following steps when called:
The abstract operation TupleEqual takes arguments x (a Tuple), y (a Tuple), and elementEqual (an
The abstract operation TupleSameValue takes arguments x (a Tuple) and y (a Tuple) and returns a Boolean. It performs the following steps when called:
The abstract operation TupleSameValueZero takes arguments x (a Tuple) and y (a Tuple) and returns a Boolean. It performs the following steps when called:
The ECMAScript language implicitly performs automatic type conversion as needed. To clarify the semantics of certain constructs it is useful to define a set of conversion
The BigInt , hashave no implicit conversions in the ECMAScript language; programmers must call BigInt ,
The abstract operation ToPrimitive takes argument input (an
There is explicit handling of
The abstract operation ToBoolean takes argument argument and returns a Boolean. It converts argument to a value of type Boolean according to
Argument Type | Result |
---|---|
Undefined |
Return |
Null |
Return |
Boolean | Return argument. |
Number |
If argument is |
String |
If argument is the empty String (its length is zero), return |
Symbol |
Return |
BigInt |
If argument is |
|
Return |
Tuple |
Return |
Object |
Return |
The abstract operation ToNumber takes argument argument. It converts argument to a value of type Number according to
Argument Type | Result |
---|---|
Undefined |
Return |
Null |
Return |
Boolean |
If argument is |
Number | Return argument (no conversion). |
String | See grammar and conversion algorithm below. |
Symbol |
Throw a |
BigInt |
Throw a |
|
Throw a |
Tuple |
Throw a |
Object |
Apply the following steps:
|
The abstract operation ToBigInt takes argument argument. It converts argument to a BigInt value, or throws if an implicit conversion from Number would be required. It performs the following steps when called:
Argument Type | Result |
---|---|
Undefined |
Throw a |
Null |
Throw a |
Boolean |
Return 1n if prim is 0n if prim is |
BigInt | Return prim. |
Number |
Throw a |
String |
|
Symbol |
Throw a |
|
Throw a |
Tuple |
Throw a |
The abstract operation ToString takes argument argument. It converts argument to a value of type String according to
Argument Type | Result |
---|---|
Undefined |
Return |
Null |
Return |
Boolean |
If argument is If argument is |
Number |
Return ! |
String | Return argument. |
Symbol |
Throw a |
BigInt |
Return ! |
|
Return |
Tuple |
Return |
Object |
Apply the following steps:
|
The abstract operation ToObject takes argument argument. It converts argument to a value of type Object according to
Argument Type | Result |
---|---|
Undefined |
Throw a |
Null |
Throw a |
Boolean |
Return a new Boolean object whose [[BooleanData]] internal slot is set to argument. See |
Number |
Return a new Number object whose [[NumberData]] internal slot is set to argument. See |
String |
Return a new String object whose [[StringData]] internal slot is set to argument. See |
Symbol |
Return a new Symbol object whose [[SymbolData]] internal slot is set to argument. See |
BigInt |
Return a new BigInt object whose [[BigIntData]] internal slot is set to argument. See |
|
Return |
Tuple |
Return a new Tuple object whose [[TupleData]] internal slot is set to argument. See |
Object | Return argument. |
The abstract operation ToPropertyKey takes argument argument and returns either a
The abstract operation RequireObjectCoercible takes argument argument. It throws an error if argument is a value that cannot be converted to an Object using
Argument Type | Result |
---|---|
Undefined |
Throw a |
Null |
Throw a |
Boolean | Return argument. |
Number | Return argument. |
String | Return argument. |
Symbol | Return argument. |
BigInt | Return argument. |
|
Return argument. |
Tuple | Return argument. |
Object | Return argument. |
The abstract operation SameValue takes arguments x (an
This algorithm differs from the Strict Equality Comparison Algorithm in its treatment of signed zeroes and NaNs.
The abstract operation SameValueZero takes arguments x (an
The abstract operation SameValueNonNumeric takes arguments x (an
The abstract operation SameValueNonGeneric takes arguments x (an
The abstract operation IsLooselyEqual takes arguments x (an
The abstract operation IsStrictlyEqual takes arguments x (an
This algorithm differs from the
The abstract operation RecordToObject takes argument value (a
The abstract operation CreateRecord takes argument entries (a
The abstract operation DeduplicateRecordEntries takes argument entries (a
The abstract operation AddPropertyIntoRecordEntriesList takes arguments entries (a
The abstract operation AddValueToTupleSequenceList takes arguments sequence (a
The abstract operation IsTuple takes argument O (an
The abstract operation ListJoin takes argument list (a
The abstract operation IsArrayOrTuple takes argument O (an
A Tuple object is an
An object is a Tuple exotic object (or simply, a Tuple object) if its following internal methods use the following implementations and is an
Tuple
When the [[IsExtensible]] internal method of a
The [[GetOwnProperty]] internal method of a
The [[DefineOwnProperty]] internal method of a
The [[HasProperty]] internal method of a
The [[Get]] internal method of a
The [[Set]] internal method of a
The [[Delete]] internal method of a
The [[OwnPropertyKeys]] internal method of a
The abstract operation TupleCreate takes argument value (a Tuple) and returns a
The abstract operation IsValidTupleIndex takes arguments T (a Tuple object) and index (a Number) and returns a Boolean. It performs the following steps when called:
The abstract operation TupleGet takes arguments T (a Tuple object) and index (a Number) and returns an
With parameter entries.
With parameter sequence.
typeof
OperatorType of val | Result |
---|---|
Undefined |
|
Null |
|
Boolean |
|
Number |
|
String |
|
Symbol |
|
BigInt |
|
|
|
Tuple |
|
Object (does not implement [[Call]]) |
|
Object (implements [[Call]]) |
|
The
new
operator or to be subclassed. It may be used as the value of an When the Record
function is called, the following steps are taken:
The
The
The parameter iterable is expected to be an object that implements an
This method performs the following steps when called:
The @@hasInstance
because unlike the other primitives its prototype is
For example,
Object(#{}) instanceof Record
will return
The method checks for the [[RecordData]] internal slot instead of checking for a
Object.create(null) instanceof Record
will return
This property has the attributes { [[Writable]]:
The value of the
The initial value of
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
The Tuple
new
operator or to be subclassed. It may be used as the value of an When the Tuple
function is called with zero or more arguments, the following steps are taken:
The Tuple
When the from
method is called with argument items and optional arguments mapfn and thisArg, the following steps are taken:
The
The initial value of
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
The Tuple prototype object:
The abstract operation thisTupleValue takes argument value and returns either a
The initial value of
The interpretation and use of the arguments of this method are the same as for Array.prototype.at
as defined in
This method performs the following steps when called:
This method performs the following steps when called:
The initial value of
This property has the attributes { [[Writable]]:
The interpretation and use of the arguments of this method are the same as for Array.prototype.slice
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 for Array.prototype.concat
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 for Array.prototype.includes
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 for Array.prototype.indexOf
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 for Array.prototype.join
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 for Array.prototype.lastIndexOf
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 for Array.prototype.every
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 for Array.prototype.filter
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 for Array.prototype.find
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 for Array.prototype.findIndex
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 for Array.prototype.findLast
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 for Array.prototype.findLsatIndex
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 for Array.prototype.flat
as defined in
This method performs the following steps when called:
The abstract operation FlattenIntoTuple takes arguments target, source, and depth and optional arguments mapperFunction and thisArg. It performs the following steps when called:
The interpretation and use of the arguments of this method are the same as for Array.prototype.flatMap
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 for Array.prototype.forEach
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 for Array.prototype.map
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 for Array.prototype.reduce
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 for Array.prototype.reduceRight
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 for Array.prototype.some
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 for Array.prototype.toLocaleString
as defined in
This method performs the following steps when called:
This method performs the following steps when called:
When the
It performs the following steps when called:
The initial value of the
The interpretation and use of the arguments of this method are the same as for Array.prototype.reverse
as defined in
Array.prototype.toReversed
.
This method performs the following steps when called:
The interpretation and use of the arguments of this method are the same as for Array.prototype.sort
as defined in
Array.prototype.toSorted
.
This method performs the following steps when called:
The elements of list are sorted in the same order as if they were sorted in an Array via %Array.prototype.sort% with comparefn as the first argument.
The interpretation and use of the arguments of this method are the same as for Array.prototype.splice
as defined in
Array.prototype.toSpliced
.
This method performs the following steps when called:
Array.prototype.with
.
This method performs the following steps when called:
When the toString
method is called, the following steps are taken:
This function is the %ObjProto_toString% intrinsic object.
Historically, this function was occasionally used to access the String value of the [[Class]] internal slot that was used in previous editions of this specification as a nominal type tag for various built-in objects. The above definition of toString
preserves compatibility for legacy code that uses toString
as a test for those specific kinds of built-in objects. It does not provide a reliable type testing mechanism for other kinds of built-in or program defined objects. In addition, programs can use
These changes to unrelated parts of the ecma262 specification are editorial and don't affect the behaviour of the modified algorithms. They are refactorings used to share existing algorithm steps with the new algorithms introduced by this proposal.
When the Set
function is called with optional argument iterable, the following steps are taken:
The abstract operation AddValuesFromIterable takes arguments target, iterable (an
The parameter iterable is expected to be an object that implements an
When the WeakSet
function is called with optional argument iterable, the following steps are taken:
Β© 2023 Robin Ricard, Rick Button, Ashley Claymore, NicolΓ² Ribaudo
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.