1. Numeric Separator
const a = 2495390; // old
const a = 2_495_390; // new
2. replaceAll
const text = "I Love sushi, sushi is Good";
const reText = text.replaceAll("sushi", "kimchi");
// "I Love "kimchi, "kimchi is Good"
3. Logical Assignment Operators
// old
let a = 1;
if(a) {
a = 2;
}
// new
let a = 1;
a &&= 2;
// old
let a = false;
if(!a) {
a = true;
}
// new
let a = false;
a ||= true;
// old
let a = undefined; // undefined or null
if(a === undefined) {
a = 'hello';
}
// new
let a = undefined;
a ??= 'hello';