What’s new in ES2021

With the January meeting of TC39 behind us, the Stage-4 features that will make it into ES2021 have been selected. The following features will be part of ES2021, which will be formalised mid-2021: String.prototype.replaceAll Promise.any WeakRefs + FinalizationRegistry Logical Assignment Operators Numeric Separators Apart from the linked-to posts above, Pawel Grzybek has done a writeup …

ESNext: Logical Assignment Operators (||=, ??=, &&=)

Update 2020.07.21: This proposal made it into Stage-4 and will officially be part of ES2021 🥳 A new ECMAScript Proposal that I’m looking forward to is Logical Assignment Operators. In short it combines Logical Operators (||, &&, and ??) with Assignment Expressions (=). // "Or Or Equals" (or, the Mallet operator) a ||= b; // …

ESNext: Replace all occurrences of a piece of text in a string with String.prototype.replaceAll

UPDATE June 2020: This feature has advanced to Stage-4 and will be part of the ES2021 Specification! 🎉 An ECMAScript Language feature that’s currently in Stage-3 is String.prototype.replaceAll, a handy way to replace all instances of a piece of text in a string. ~ The Problem If you ever needed to replace a piece of …