ES11 - ECMAScript 2020
globalThis
The global globalThis
property contains the global this
value, which is akin to the global object.
Promise.allSettled()
The Promise.allSettled()
method returns a promise that resolves after all of the given promises have either fulfilled or rejected, with an array of objects that each describes the outcome of each promise.
nullish coalescing operator (??
)
??
)The nullish coalescing operator (??
) is a logical operator that returns its right-hand side operand when its left-hand side operand is null
or undefined
, and otherwise returns its left-hand side operand.
optional chaining operator (?.
)
?.
)The optional chaining operator (?.
) permits reading the value of a property located deep within a chain of connected objects without having to expressly validate that each reference in the chain is valid. The ?.
operator functions similarly to the .
chaining operator, except that instead of causing an error if a reference is nullish (null
or undefined
), the expression short-circuits with a return value of undefined
. When used with function calls, it returns undefined
if the given function does not exist.
Example 1
Example 2
BigInt — Arbitrary precision integers
BigInt is the 7th primitive type.
BigInt is an arbitrary-precision integer. What this means is that variables can now represent 2⁵³ numbers. And not just max out at 9007199254740992.
String.prototype.matchAll()
The matchAll()
method returns an iterator of all results matching a string against a regular expression, including capturing groups.
Dynamic import
Imports can now be assigned to a variable
Last updated