ECMAScript 2018 (ES9)
ECMAScript 2018 (ES9) — ES2018 introduced rest/spread for objects, async iteration, and Promise.finally. Object rest/spread: Spread object properties into a new object. Example: const copy = { ...original, updated: true }. Async iteration: for-await-of loop for async iterable sources. Example: for await (const item of asyncIterable) {}. Promise.prototype.finally(): Runs cleanup code regardless of promise outcome. Example: fetch(url).then(r => r.json()).finally(() => hideLoader()). RegExp named capture groups: Name your capture groups for readability. Example: /(?\d{4})/.exec("2024").groups.year. RegExp lookbehind assertions: Match patterns that precede a position. Example: /(?<=\$)\d+/.exec("$100") // "100". s flag (dotAll) for RegExp: Make . match newline characters. Example: /hello.world/s.test("hello\nworld") // true. In total, ES2018 added 6 documented features to the language. Compare with the other editions on the ECMAScript versions page.