4 New Features of ECMAScript 2021

The ECMAScript 2021 version is expected to be released in June, here’s a sneak peek into some of the great new features developers can soon start taking advantage of!

Numeric Separators

Benefits: Improves readability of numeric literals by allowing developers to use the underscore character as a separator between groups of digits.

Syntax:

Promise.any()

Benefits: Takes in multiple promises and resolves once any of the promises are resolved. If no promise resolves, promise.any() throws an AggregateError exception and logs the error in the console.

Syntax:

String replaceAll() Method

Benefits: Replaces all occurrences of a string with another string value. Developers no longer have to use regex to accomplish this.

Syntax:

Logical Assignment Operators

Benefits: Combines the logical operations (&&, ||, ??) with assignment.

Syntax:

--

--