JS: ECMAScript 2018

By Xah Lee. Date: . Last updated: .

Destructure object rest properties

// destructure object with rest keys
let { bb, ...keyrest } = { aa: "a", bb: "b", cc: "c" };
console.log(bb === "b");
// true

console.log(JSON.stringify(keyrest) === `{"aa":"a","cc":"c"}`);
// true

Spread operator for object literal

const xx = { ...{ a: 1, b: 2 }, c: 3 };
console.log(JSON.stringify(xx) === `{"a":1,"b":2,"c":3}`);

Regex Features

async iteration

xtodo

support for asynchronous iteration via the AsyncIterator protocol and async generators.

promise finally

xtodo

JavaScript. ECMAScript New Features