Good news â the new ES2020 features are now finalized! This means we now have a complete idea of the changes happening in ES2020, the new and improved specification of JavaScript. So letâs see what those changes are.
. But BigInt actually allows you to go even beyond that. However, you need to have an n
appended at the very end of the number, as you can see above. This n
denotes that this is a BigInt and should be treated differently by the JavaScript engine (by the v8 engine or whatever engine it is using). This improvement is not backwards compatible because the traditional number system is IEEE754 (which just cannot support numbers of this size).nullish
values instead of falsey
values. What is the difference between nullish
and falsey
values, you might ask?In JavaScript, a lot of values are falsey
, like empty strings, the number 0, undefined
, null
, false
, NaN
, and so on.
However, a lot of times you might want to check if a variable is nullish â that is if it is either undefined
or null
, like when itâs okay for a variable to have an empty string, or even a false value.
In that case, youâll use the new nullish coalescing operator ??
undefined
will be returned. This not only works on object properties, but also on function calls and arrays. Super convenient! Hereâs an example:race
and all
were available. This brings âJust run all promises â I donât care about the resultsâ natively to JavaScript.matchAll
is a new method added to the String
prototype which is related to Regular Expressions. This returns an iterator which returns all matched groups one after another. Letâs have a look at a quick example:window
for browsers, global
for Node, and self
for web workers. If there are more runtimes, the global object will be different for them as well. So you would have had to have your own implementation of detecting runtime and then using the correct global â that is, until now. ES2020 brings us globalThis
which always refers to the global object, no matter where you are executing your code:However, no symmetric export
syntax existed, until now:
This is equivalent to the following: