Member-only story
JavaScript ES2021 (ES12) Approved Features
New features in JavaScript ES2021 (ES12) that have been approved by the Ecma General Assembly
About a year ago, I wrote an article about the new features that JavaScript would incorporate in its ES2021 specification.
Today, in June 2021, these features, along with others, have been approved.
In this article, I elaborate and detail what I wrote more than a year ago, but with the addition of the final features that have been approved.
Index
- String.prototype.replaceAll()
- Promise.any() and AggregateError
- WeakRefs and FinalizationRegistry
- Logical assignment operators
- Numeric separators
String.prototype.replaceAll()
String.prototype.replaceAll() replace all instances of a substring in a string with another string value, without using a global regexp.
Until now, the most common way of doing this was to use a global regexp.
Consider the following code where we use a regular expression to replace the “+” character with an empty character:










