ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 6

 

  Главная      Manuals     ECMA-262 (12th Edition) ECMAScript 2021 Language Specification

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     4      5      6      7     ..

 

 

 

ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 6

 

 

27.1.4.3 Properties of Async-from-Sync Iterator Instances
27.1.4.4 AsyncFromSyncIteratorContinuation ( 

result

promiseCapability

 )

27.2 Promise Objects

27.2.1 Promise Abstract Operations

27.2.1.1 PromiseCapability Records

27.2.1.1.1 IfAbruptRejectPromise ( 

value

capability

 )

27.2.1.2 PromiseReaction Records
27.2.1.3 CreateResolvingFunctions ( 

promise

 )

27.2.1.3.1 Promise Reject Functions
27.2.1.3.2 Promise Resolve Functions

27.2.1.4 FulfillPromise ( 

promise

value

 )

27.2.1.5 NewPromiseCapability ( 

C

 )

27.2.1.5.1 GetCapabilitiesExecutor Functions

27.2.1.6 IsPromise ( 

x

 )

27.2.1.7 RejectPromise ( 

promise

reason

 )

27.2.1.8 TriggerPromiseReactions ( 

reactions

argument

 )

27.2.1.9 HostPromiseRejectionTracker ( 

promise

operation

 )

27.2.2 Promise Jobs

27.2.2.1 NewPromiseReactionJob ( 

reaction

argument

 )

27.2.2.2 NewPromiseResolveThenableJob ( 

promiseToResolve

thenable

then

 )

27.2.3 The Promise Constructor

27.2.3.1 Promise ( 

executor

 )

27.2.4 Properties of the Promise Constructor

27.2.4.1 Promise.all ( 

iterable

 )

27.2.4.1.1 GetPromiseResolve ( 

promiseConstructor

 )

27.2.4.1.2 PerformPromiseAll ( 

iteratorRecord

constructor

resultCapability

promiseResolve

 )

27.2.4.1.3 

Promise.all

Promise.all

 Resolve Element Functions

27.2.4.2 Promise.allSettled ( 

iterable

 )

27.2.4.2.1 PerformPromiseAllSettled ( 

iteratorRecord

constructor

resultCapability

promiseResolve

 )

27.2.4.2.2 

Promise.allSettled

Promise.allSettled

 Resolve Element Functions

27.2.4.2.3 

Promise.allSettled

Promise.allSettled

 Reject Element Functions

27.2.4.3 Promise.any ( 

iterable

 )

27.2.4.3.1 PerformPromiseAny ( 

iteratorRecord

constructor

resultCapability

promiseResolve

 )

27.2.4.3.2 

Promise.any

Promise.any

 Reject Element Functions

27.2.4.4 Promise.prototype
27.2.4.5 Promise.race ( 

iterable

 )

27.2.4.5.1 PerformPromiseRace ( 

iteratorRecord

constructor

resultCapability

promiseResolve

 )

27.2.4.6 Promise.reject ( 

r

 )

27.2.4.7 Promise.resolve ( 

x

 )

27.2.4.7.1 PromiseResolve ( 

C

x

 )

27.2.4.8 get Promise [ @@species ]

27.2.5 Properties of the Promise Prototype Object

27.2.5.1 Promise.prototype.catch ( 

onRejected

 )

27.2.5.2 Promise.prototype.constructor
27.2.5.3 Promise.prototype.finally ( 

onFinally

 )

27.2.5.3.1 Then Finally Functions
27.2.5.3.2 Catch Finally Functions

27.2.5.4 Promise.prototype.then ( 

onFulfilled

onRejected

 )

38

27.2.5.4.1 PerformPromiseThen ( 

promise

onFulfilled

onRejected

 [ , 

resultCapability

 ] )

27.2.5.5 Promise.prototype [ @@toStringTag ]

27.2.6 Properties of Promise Instances

27.3 GeneratorFunction Objects

27.3.1 The GeneratorFunction Constructor

27.3.1.1 GeneratorFunction ( 

p1

p2

, … , 

pn

body

 )

27.3.2 Properties of the GeneratorFunction Constructor

27.3.2.1 GeneratorFunction.length
27.3.2.2 GeneratorFunction.prototype

27.3.3 Properties of the GeneratorFunction Prototype Object

27.3.3.1 GeneratorFunction.prototype.constructor
27.3.3.2 GeneratorFunction.prototype.prototype
27.3.3.3 GeneratorFunction.prototype [ @@toStringTag ]

27.3.4 GeneratorFunction Instances

27.3.4.1 length
27.3.4.2 name
27.3.4.3 prototype

27.4 AsyncGeneratorFunction Objects

27.4.1 The AsyncGeneratorFunction Constructor

27.4.1.1 AsyncGeneratorFunction ( 

p1

p2

, … , 

pn

body

 )

27.4.2 Properties of the AsyncGeneratorFunction Constructor

27.4.2.1 AsyncGeneratorFunction.length
27.4.2.2 AsyncGeneratorFunction.prototype

27.4.3 Properties of the AsyncGeneratorFunction Prototype Object

27.4.3.1 AsyncGeneratorFunction.prototype.constructor
27.4.3.2 AsyncGeneratorFunction.prototype.prototype
27.4.3.3 AsyncGeneratorFunction.prototype [ @@toStringTag ]

27.4.4 AsyncGeneratorFunction Instances

27.4.4.1 length
27.4.4.2 name
27.4.4.3 prototype

27.5 Generator Objects

27.5.1 Properties of the Generator Prototype Object

27.5.1.1 Generator.prototype.constructor
27.5.1.2 Generator.prototype.next ( 

value

 )

27.5.1.3 Generator.prototype.return ( 

value

 )

27.5.1.4 Generator.prototype.throw ( 

exception

 )

27.5.1.5 Generator.prototype [ @@toStringTag ]

27.5.2 Properties of Generator Instances
27.5.3 Generator Abstract Operations

27.5.3.1 GeneratorStart ( 

generator

generatorBody

 )

27.5.3.2 GeneratorValidate ( 

generator

generatorBrand

 )

27.5.3.3 GeneratorResume ( 

generator

value

generatorBrand

 )

27.5.3.4 GeneratorResumeAbrupt ( 

generator

abruptCompletion

generatorBrand

 )

27.5.3.5 GetGeneratorKind ( )
27.5.3.6 GeneratorYield ( 

iterNextObj

 )

27.5.3.7 Yield ( 

value

 )

27.5.3.8 CreateIteratorFromClosure ( 

closure

generatorBrand

generatorPrototype

 )

39

27.6 AsyncGenerator Objects

27.6.1 Properties of the AsyncGenerator Prototype Object

27.6.1.1 AsyncGenerator.prototype.constructor
27.6.1.2 AsyncGenerator.prototype.next ( 

value

 )

27.6.1.3 AsyncGenerator.prototype.return ( 

value

 )

27.6.1.4 AsyncGenerator.prototype.throw ( 

exception

 )

27.6.1.5 AsyncGenerator.prototype [ @@toStringTag ]

27.6.2 Properties of AsyncGenerator Instances
27.6.3 AsyncGenerator Abstract Operations

27.6.3.1 AsyncGeneratorRequest Records
27.6.3.2 AsyncGeneratorStart ( 

generator

generatorBody

 )

27.6.3.3 AsyncGeneratorValidate ( 

generator

generatorBrand

 )

27.6.3.4 AsyncGeneratorResolve ( 

generator

value

done

 )

27.6.3.5 AsyncGeneratorReject ( 

generator

exception

 )

27.6.3.6 AsyncGeneratorResumeNext ( 

generator

 )

27.6.3.6.1 AsyncGeneratorResumeNext Return Processor Fulfilled Functions
27.6.3.6.2 AsyncGeneratorResumeNext Return Processor Rejected Functions

27.6.3.7 AsyncGeneratorEnqueue ( 

generator

completion

generatorBrand

 )

27.6.3.8 AsyncGeneratorYield ( 

value

 )

27.6.3.9 CreateAsyncIteratorFromClosure ( 

closure

generatorBrand

generatorPrototype

 )

27.7 AsyncFunction Objects

27.7.1 The AsyncFunction Constructor

27.7.1.1 AsyncFunction ( 

p1

p2

, … , 

pn

body

 )

27.7.2 Properties of the AsyncFunction Constructor

27.7.2.1 AsyncFunction.length
27.7.2.2 AsyncFunction.prototype

27.7.3 Properties of the AsyncFunction Prototype Object

27.7.3.1 AsyncFunction.prototype.constructor
27.7.3.2 AsyncFunction.prototype [ @@toStringTag ]

27.7.4 AsyncFunction Instances

27.7.4.1 length
27.7.4.2 name

27.7.5 Async Functions Abstract Operations

27.7.5.1 AsyncFunctionStart ( 

promiseCapability

asyncFunctionBody

 )

28 Reflection

28.1 The Reflect Object

28.1.1 Reflect.apply ( 

target

thisArgument

argumentsList

 )

28.1.2 Reflect.construct ( 

target

argumentsList

 [ , 

newTarget

 ] )

28.1.3 Reflect.defineProperty ( 

target

propertyKey

attributes

 )

28.1.4 Reflect.deleteProperty ( 

target

propertyKey

 )

28.1.5 Reflect.get ( 

target

propertyKey

 [ , 

receiver

 ] )

28.1.6 Reflect.getOwnPropertyDescriptor ( 

target

propertyKey

 )

28.1.7 Reflect.getPrototypeOf ( 

target

 )

28.1.8 Reflect.has ( 

target

propertyKey

 )

28.1.9 Reflect.isExtensible ( 

target

 )

28.1.10 Reflect.ownKeys ( 

target

 )

28.1.11 Reflect.preventExtensions ( 

target

 )

28.1.12 Reflect.set ( 

target

propertyKey

V

 [ , 

receiver

 ] )

40

GeneratorExpression

 

:

 

function

 

*

 

BindingIdentifier

opt

 

(

 

FormalParameters

 

)

 

{

 

GeneratorBody

 

}

1.  Return 

InstantiateGeneratorFunctionExpression

 of 

GeneratorExpression

.

YieldExpression

 

:

 

yield

1.  Return ? 

Yield

(

undefined

).

YieldExpression

 

:

 

yield

 

AssignmentExpression

1.  Let 

exprRef

 be the result of evaluating 

AssignmentExpression

.

2.  Let 

value

 be ? 

GetValue

(

exprRef

).

3.  Return ? 

Yield

(

value

).

YieldExpression

 

:

 

yield

 

*

 

AssignmentExpression

1.  Let 

generatorKind

 be ! 

GetGeneratorKind

().

2.  Let 

exprRef

 be the result of evaluating 

AssignmentExpression

.

3.  Let 

value

 be ? 

GetValue

(

exprRef

).

4.  Let 

iteratorRecord

 be ? 

GetIterator

(

value

generatorKind

).

5.  Let 

iterator

 be 

iteratorRecord

.[[Iterator]].

6.  Let 

received

 be 

NormalCompletion

(

undefined

).

7.  Repeat,

a.  If 

received

.[[Type]] is 

normal

, then

i.  Let 

innerResult

 be ? 

Call

(

iteratorRecord

.[[NextMethod]], 

iteratorRecord

.[[Iterator]], « 

received

.

[[Value]] »).

ii.  If 

generatorKind

 is 

async

, set 

innerResult

 to ? 

Await

(

innerResult

).

iii.  If 

Type

(

innerResult

) is not Object, throw a 

TypeError

 exception.

iv.  Let 

done

 be ? 

IteratorComplete

(

innerResult

).

v.  If 

done

 is 

true

, then

1.  Return ? 

IteratorValue

(

innerResult

).

vi.  If 

generatorKind

 is 

async

, set 

received

 to 

AsyncGeneratorYield

(? 

IteratorValue

(

innerResult

)).

vii.  Else, set 

received

 to 

GeneratorYield

(

innerResult

).

b.  Else if 

received

.[[Type]] is 

throw

, then

i.  Let 

throw

 be ? 

GetMethod

(

iterator

"throw"

).

ii.  If 

throw

 is not 

undefined

, then

1.  Let 

innerResult

 be ? 

Call

(

throw

iterator

, « 

received

.[[Value]] »).

2.  If 

generatorKind

 is 

async

, set 

innerResult

 to ? 

Await

(

innerResult

).

3.  NOTE: Exceptions from the inner iterator 

throw

throw

 method are propagated. Normal

completions from an inner 

throw

throw

 method are processed similarly to an inner 

next

next

.

4.  If 

Type

(

innerResult

) is not Object, throw a 

TypeError

 exception.

5.  Let 

done

 be ? 

IteratorComplete

(

innerResult

).

6.  If 

done

 is 

true

, then

a.  Return ? 

IteratorValue

(

innerResult

).

7.  If 

generatorKind

 is 

async

, set 

received

 to 

AsyncGeneratorYield

(? 

IteratorValue

(

innerResult

)).

8.  Else, set 

received

 to 

GeneratorYield

(

innerResult

).

iii.  Else,

1.  NOTE: If 

iterator

 does not have a 

throw

throw

 method, this throw is going to terminate the

yield*

yield*

 loop. But first we need to give 

iterator

 a chance to clean up.

407

2.  Let 

closeCompletion

 be 

Completion

 { [[Type]]: 

normal

, [[Value]]: 

empty

, [[Target]]: 

empty

 }.

3.  If 

generatorKind

 is 

async

, perform ? 

AsyncIteratorClose

(

iteratorRecord

closeCompletion

).

4.  Else, perform ? 

IteratorClose

(

iteratorRecord

closeCompletion

).

5.  NOTE: The next step throws a 

TypeError

 to indicate that there was a 

yield*

yield*

 protocol

violation: 

iterator

 does not have a 

throw

throw

 method.

6.  Throw a 

TypeError

 exception.

c.  Else,

i. 

Assert

received

.[[Type]] is 

return

.

ii.  Let 

return

 be ? 

GetMethod

(

iterator

"return"

).

iii.  If 

return

 is 

undefined

, then

1.  If 

generatorKind

 is 

async

, set 

received

.[[Value]] to ? 

Await

(

received

.[[Value]]).

2.  Return 

Completion

(

received

).

iv.  Let 

innerReturnResult

 be ? 

Call

(

return

iterator

, « 

received

.[[Value]] »).

v.  If 

generatorKind

 is 

async

, set 

innerReturnResult

 to ? 

Await

(

innerReturnResult

).

vi.  If 

Type

(

innerReturnResult

) is not Object, throw a 

TypeError

 exception.

vii.  Let 

done

 be ? 

IteratorComplete

(

innerReturnResult

).

viii.  If 

done

 is 

true

, then

1.  Let 

value

 be ? 

IteratorValue

(

innerReturnResult

).

2.  Return 

Completion

 { [[Type]]: 

return

, [[Value]]: 

value

, [[Target]]: 

empty

 }.

ix.  If 

generatorKind

 is 

async

, set 

received

 to 

AsyncGeneratorYield

(? 

IteratorValue

(

innerReturnResult

)).

x.  Else, set 

received

 to 

GeneratorYield

(

innerReturnResult

).

AsyncGeneratorMethod

[Yield, Await]

 

:

async

 [no 

LineTerminator

 here]  

*

 

PropertyName

[?Yield, ?Await]

 

(

UniqueFormalParameters

[+Yield, +Await]

 

)

 

{

 

AsyncGeneratorBody

 

}

AsyncGeneratorDeclaration

[Yield, Await, Default]

 

:

async

 [no 

LineTerminator

 here]  

function

 

*

 

BindingIdentifier

[?Yield, ?Await]

 

(

FormalParameters

[+Yield, +Await]

 

)

 

{

 

AsyncGeneratorBody

 

}

[+Default]

 

async

 [no 

LineTerminator

 here]  

function

 

*

 

(

 

FormalParameters

[+Yield, +Await]

 

)

 

{

AsyncGeneratorBody

 

}

AsyncGeneratorExpression

 

:

async

 [no 

LineTerminator

 here]  

function

 

*

 

BindingIdentifier

[+Yield, +Await]

opt

 

(

FormalParameters

[+Yield, +Await]

 

)

 

{

 

AsyncGeneratorBody

 

}

AsyncGeneratorBody

 

:

FunctionBody

[+Yield, +Await]

15.6  Async Generator Function Definitions

Syntax

408

B.1 Additional Syntax

B.1.1 Numeric Literals

B.1.1.1 Static Semantics

B.1.2 String Literals

B.1.2.1 Static Semantics

B.1.3 HTML-like Comments
B.1.4 Regular Expressions Patterns

B.1.4.1 SS: Early Errors
B.1.4.2 SS: IsCharacterClass
B.1.4.3 SS: CharacterValue
B.1.4.4 Pattern Semantics

B.1.4.4.1 CharacterRangeOrUnion ( 

A

B

 )

B.2 Additional Built-in Properties

B.2.1 Additional Properties of the Global Object

B.2.1.1 escape ( 

string

 )

B.2.1.2 unescape ( 

string

 )

B.2.2 Additional Properties of the Object.prototype Object

B.2.2.1 Object.prototype.__proto__

B.2.2.1.1 get Object.prototype.__proto__
B.2.2.1.2 set Object.prototype.__proto__

B.2.2.2 Object.prototype.__defineGetter__ ( 

P

getter

 )

B.2.2.3 Object.prototype.__defineSetter__ ( 

P

setter

 )

B.2.2.4 Object.prototype.__lookupGetter__ ( 

P

 )

B.2.2.5 Object.prototype.__lookupSetter__ ( 

P

 )

B.2.3 Additional Properties of the String.prototype Object

B.2.3.1 String.prototype.substr ( 

start

length

 )

B.2.3.2 String.prototype.anchor ( 

name

 )

B.2.3.2.1 CreateHTML ( 

string

tag

attribute

value

 )

B.2.3.3 String.prototype.big ( )
B.2.3.4 String.prototype.blink ( )
B.2.3.5 String.prototype.bold ( )
B.2.3.6 String.prototype.fixed ( )
B.2.3.7 String.prototype.fontcolor ( 

color

 )

B.2.3.8 String.prototype.fontsize ( 

size

 )

B.2.3.9 String.prototype.italics ( )
B.2.3.10 String.prototype.link ( 

url

 )

B.2.3.11 String.prototype.small ( )
B.2.3.12 String.prototype.strike ( )
B.2.3.13 String.prototype.sub ( )
B.2.3.14 String.prototype.sup ( )
B.2.3.15 String.prototype.trimLeft ( )
B.2.3.16 String.prototype.trimRight ( )

B.2.4 Additional Properties of the Date.prototype Object

B.2.4.1 Date.prototype.getYear ( )
B.2.4.2 Date.prototype.setYear ( 

year

 )

B.2.4.3 Date.prototype.toGMTString ( )

B.2.5 Additional Properties of the RegExp.prototype Object

B.2.5.1 RegExp.prototype.compile ( 

pattern

flags

 )

42

This Ecma Standard defines the ECMAScript 2021 Language. It is the twelfth edition of the ECMAScript Language
Specification. Since publication of the first edition in 1997, ECMAScript has grown to be one of the world's most
widely used general-purpose programming languages. It is best known as the language embedded in web browsers
but has also been widely adopted for server and embedded applications.

ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and
JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company's
Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft
starting with Internet Explorer 3.0.

The development of the ECMAScript Language Specification started in November 1996. The first edition of this Ecma
Standard was adopted by the Ecma General Assembly of June 1997.

That Ecma Standard was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved as
international standard ISO/IEC 16262, in April 1998. The Ecma General Assembly of June 1998 approved the second
edition of ECMA-262 to keep it fully aligned with ISO/IEC 16262. Changes between the first and the second edition
are editorial in nature.

The third edition of the Standard introduced powerful regular expressions, better string handling, new control
statements, try/catch exception handling, tighter definition of errors, formatting for numeric output and minor
changes in anticipation of future language growth. The third edition of the ECMAScript standard was adopted by the
Ecma General Assembly of December 1999 and published as ISO/IEC 16262:2002 in June 2002.

After publication of the third edition, ECMAScript achieved massive adoption in conjunction with the World Wide
Web where it has become the programming language that is supported by essentially all web browsers. Significant
work was done to develop a fourth edition of ECMAScript. However, that work was not completed and not published
as the fourth edition of ECMAScript but some of it was incorporated into the development of the sixth edition.

The fifth edition of ECMAScript (published as ECMA-262 5

th

 edition) codified de facto interpretations of the language

specification that have become common among browser implementations and added support for new features that
had emerged since the publication of the third edition. Such features include accessor properties, reflective creation
and inspection of objects, program control of property attributes, additional array manipulation functions, support for
the JSON object encoding format, and a strict mode that provides enhanced error checking and program security. The
fifth edition was adopted by the Ecma General Assembly of December 2009.

The fifth edition was submitted to ISO/IEC JTC 1 for adoption under the fast-track procedure, and approved as
international standard ISO/IEC 16262:2011. Edition 5.1 of the ECMAScript Standard incorporated minor corrections
and is the same text as ISO/IEC 16262:2011. The 5.1 Edition was adopted by the Ecma General Assembly of June 2011.

Focused development of the sixth edition started in 2009, as the fifth edition was being prepared for publication.
However, this was preceded by significant experimentation and language enhancement design efforts dating to the
publication of the third edition in 1999. In a very real sense, the completion of the sixth edition is the culmination of a
fifteen year effort. The goals for this edition included providing better support for large applications, library creation,
and for use of ECMAScript as a compilation target for other languages. Some of its major enhancements included
modules, class declarations, lexical block scoping, iterators and generators, promises for asynchronous programming,
destructuring patterns, and proper tail calls. The ECMAScript library of built-ins was expanded to support additional
data abstractions including maps, sets, and arrays of binary numeric values as well as additional support for Unicode
supplemental characters in strings and regular expressions. The built-ins were also made extensible via subclassing.

Introduction

44

The sixth edition provides the foundation for regular, incremental language and library enhancements. The sixth
edition was adopted by the General Assembly of June 2015.

ECMAScript 2016 was the first ECMAScript edition released under Ecma TC39's new yearly release cadence and open
development process. A plain-text source document was built from the ECMAScript 2015 source document to serve as
the base for further development entirely on GitHub. Over the year of this standard's development, hundreds of pull
requests and issues were filed representing thousands of bug fixes, editorial fixes and other improvements.
Additionally, numerous software tools were developed to aid in this effort including Ecmarkup, Ecmarkdown, and
Grammarkdown. ES2016 also included support for a new exponentiation operator and adds a new method to

Array.prototype

Array.prototype

 called 

includes

includes

.

ECMAScript 2017 introduced Async Functions, Shared Memory, and Atomics along with smaller language and library
enhancements, bug fixes, and editorial updates. Async functions improve the asynchronous programming experience
by providing syntax for promise-returning functions. Shared Memory and Atomics introduce a new 

memory model

that allows multi-

agent

 programs to communicate using atomic operations that ensure a well-defined execution order

even on parallel CPUs. It also included new static methods on Object: 

Object.values

Object.values

Object.entries

Object.entries

, and

Object.getOwnPropertyDescriptors

Object.getOwnPropertyDescriptors

.

ECMAScript 2018 introduced support for asynchronous iteration via the AsyncIterator protocol and async generators.
It also included four new regular expression features: the 

dotAll

dotAll

 flag, named capture groups, Unicode property

escapes, and look-behind assertions. Lastly it included object rest and spread properties.

ECMAScript 2019 introduced a few new built-in functions: 

flat

flat

 and 

flatMap

flatMap

 on 

Array.prototype

Array.prototype

 for

flattening arrays, 

Object.fromEntries

Object.fromEntries

 for directly turning the return value of 

Object.entries

Object.entries

 into a new

Object, and 

trimStart

trimStart

 and 

trimEnd

trimEnd

 on 

String.prototype

String.prototype

 as better-named alternatives to the widely

implemented but non-standard 

String.prototype.trimLeft

String.prototype.trimLeft

 and 

trimRight

trimRight

 built-ins. In addition, it

included a few minor updates to syntax and semantics. Updated syntax included optional catch binding parameters
and allowing U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) in string literals to align with
JSON. Other updates included requiring that 

Array.prototype.sort

Array.prototype.sort

 be a stable sort, requiring that

JSON.stringify

JSON.stringify

 return well-formed UTF-8 regardless of input, and clarifying

Function.prototype.toString

Function.prototype.toString

 by requiring that it either return the corresponding original source text or a

standard placeholder.

ECMAScript 2020, the 11

th

 edition, introduces the 

matchAll

matchAll

 method for Strings, to produce an iterator for all match

objects generated by a global regular expression; 

import()

import()

, a syntax to asynchronously import Modules with a

dynamic specifier; 

BigInt

BigInt

, a new number primitive for working with arbitrary precision integers;

Promise.allSettled

Promise.allSettled

, a new Promise combinator that does not short-circuit; 

globalThis

globalThis

, a universal way to

access the global 

this

this

 value; dedicated 

export * as ns from 'module'

export * as ns from 'module'

 syntax for use within modules;

increased standardization of 

for-in

for-in

 enumeration order; 

import.meta

import.meta

, a 

host

-populated object available in

Modules that may contain contextual information about the Module; as well as adding two new syntax features to
improve working with “nullish” values (

null

null

 or 

undefined

undefined

): nullish coalescing, a value selection operator; and

optional chaining, a property access and function invocation operator that short-circuits if the value to access/invoke
is nullish.

This specification, the 12

th

 edition, introduces the 

replaceAll

replaceAll

 method for Strings; 

Promise.any

Promise.any

, a Promise

combinator that short-circuits when an input value is fulfilled; 

AggregateError

AggregateError

, a new Error type to represent

multiple errors at once; logical assignment operators (

??=

??=

&&=

&&=

||=

||=

); 

WeakRef

WeakRef

, for referring to a target object

without preserving it from garbage collection, and 

FinalizationRegistry

FinalizationRegistry

, to manage registration and

45

 

 

 

 

 

 

 

Content      ..     4      5      6      7     ..