ECMAScript Versions
Quick-reference of notable features added in each ECMAScript edition from ES2015 to ES2026. Listed newest-first. Based on Paweล Grzybek's annual ECMAScript roundup.
ES2026โ
| Feature | Description | Link |
|---|---|---|
Array.fromAsync | Creates an array from an async iterable | MDN |
Error.isError | Safe cross-realm error detection | MDN |
Math.sumPrecise | Sums an iterable with better floating-point precision | MDN |
| Uint8Array Base64/hex | Built-in toBase64(), toHex(), fromBase64(), fromHex() | MDN |
Iterator.concat | Concatenate multiple iterators into one | MDN |
| JSON.parse source text access | Reviver gets raw source string; JSON.rawJSON() for lossless BigInts | MDN |
Map.prototype.getOrInsert | Insert-if-absent pattern built into Map | MDN |
const arr = await Array.fromAsync(asyncGenerator());
const cache = new Map();
const value = cache.getOrInsertComputed("key", () => expensiveCompute());
ES2025โ
| Feature | Description | Link |
|---|---|---|
| Set methods | intersection, union, difference, symmetricDifference, isSubsetOf, isSupersetOf, isDisjointFrom | MDN |
| Iterator Helpers | map, filter, take, drop, flatMap, reduce, toArray on iterators | MDN |
Promise.try | Wraps sync or async functions into a Promise chain | MDN |
| Import Attributes | import x from "./f.json" with { type: "json" } | MDN |
Float16Array | Half-precision 16-bit float typed array | MDN |
RegExp.escape | Escapes a string for safe use inside a RegExp | MDN |
| Duplicate named capture groups | Same (?<name>...) allowed in different regex alternatives | MDN |
| RegExp pattern modifiers | Apply flags like (?i:...) to a sub-expression only | MDN |
const a = new Set([1, 2, 3]);
const b = new Set([2, 3, 4]);
a.intersection(b); // Set {2, 3}
const evens = Iterator.from([1, 2, 3, 4, 5])
.filter(n => n % 2 === 0)
.toArray(); // [2, 4]
import data from "./config.json" with { type: "json" };
ES2024โ
| Feature | Description | Link |
|---|---|---|
Object.groupBy / Map.groupBy | Group array elements by a callback | MDN |
Promise.withResolvers | Returns { promise, resolve, reject } for deferred promises | MDN |
| Well-Formed Unicode Strings | isWellFormed() and toWellFormed() on strings | MDN |
Atomics.waitAsync | Asynchronous atomic wait, usable on the main thread | MDN |
RegExp v flag | Unicode set notation with -- subtraction and && intersection | MDN |
| Resizable ArrayBuffer | ArrayBuffer with maxByteLength and resize() | MDN |
| ArrayBuffer transfer | transfer() and transferToFixedLength() | MDN |
const grouped = Object.groupBy(items, item => item.category);
const { promise, resolve, reject } = Promise.withResolvers();
ES2023โ
| Feature | Description | Link |
|---|---|---|
| Change Array by Copy | toReversed(), toSorted(), toSpliced(), with() โ immutable operations | MDN |
findLast / findLastIndex | Search from the end of an array | MDN |
| Hashbang Grammar | #!/usr/bin/env node recognized by the parser | MDN |
| Symbols as WeakMap keys | Non-registered Symbols can be WeakMap/WeakSet keys | MDN |
const sorted = arr.toSorted((a, b) => a - b); // original unchanged
const updated = arr.with(2, "new value");
ES2022โ
| Feature | Description | Link |
|---|---|---|
| Class fields & private methods | Public/static/#private fields and methods | MDN |
Top-level await | Use await at module top level | MDN |
.at() method | Relative indexing with negative indices | MDN |
Object.hasOwn | Safer replacement for hasOwnProperty | MDN |
Error cause | new Error("msg", { cause }) for chained errors | MDN |
RegExp Match Indices (d flag) | exec() results include .indices | MDN |
Class static {} blocks | Static initialization logic in class body | MDN |
const last = arr.at(-1);
class Counter {
#count = 0;
increment() { this.#count++; }
}
ES2021โ
| Feature | Description | Link |
|---|---|---|
String.prototype.replaceAll | Replace all occurrences without regex | MDN |
Promise.any | Resolves with first fulfilled; rejects with AggregateError | MDN |
Logical assignment (&&=, ||=, ??=) | Combine logical operators with assignment | MDN |
| Numeric separators | 1_000_000 for readable numbers | MDN |
| WeakRef & FinalizationRegistry | Weak references and GC callbacks | MDN |
const text = "aabbcc".replaceAll("b", "x"); // "aaxxcc"
user.name ??= "Anonymous";
ES2020โ
| Feature | Description | Link |
|---|---|---|
Optional chaining (?.) | Safe property access through nullable chains | MDN |
Nullish coalescing (??) | Default only for null/undefined, not falsy | MDN |
BigInt | Arbitrary-precision integers (123n) | MDN |
Promise.allSettled | Waits for all promises regardless of outcome | MDN |
globalThis | Universal global object across environments | MDN |
Dynamic import() | On-demand module loading | MDN |
String.prototype.matchAll | Iterator of all regex matches with groups | MDN |
import.meta | Host-specific module metadata | MDN |
const name = user?.profile?.name ?? "Anonymous";
const module = await import("./feature.js");
ES2019โ
| Feature | Description | Link |
|---|---|---|
Array.prototype.flat / flatMap | Flatten nested arrays; map then flatten | MDN |
Object.fromEntries | Create object from key-value pairs | MDN |
String.prototype.trimStart/trimEnd | Trim whitespace from one end | MDN |
| Optional catch binding | catch {} without parameter | MDN |
Symbol.prototype.description | Direct access to Symbol's description | MDN |
Stable Array.prototype.sort | Sort guaranteed to be stable | MDN |
const flat = [[1, 2], [3, 4]].flat(); // [1, 2, 3, 4]
const obj = Object.fromEntries(new URLSearchParams("a=1&b=2"));
ES2018โ
| Feature | Description | Link |
|---|---|---|
Object rest/spread ({...obj}) | Spread properties for objects | MDN |
Async iteration (for await...of) | Iterate over async iterables | MDN |
Promise.prototype.finally | Callback after promise settles | MDN |
| RegExp named capture groups | (?<name>...) syntax | MDN |
RegExp s (dotAll) flag | . matches line terminators | MDN |
| RegExp lookbehind assertions | (?<=...) and (?<!...) | MDN |
| RegExp Unicode property escapes | \p{Script=Greek} with u flag | MDN |
const { a, ...rest } = { a: 1, b: 2, c: 3 }; // rest = { b: 2, c: 3 }
for await (const chunk of readableStream) {
process(chunk);
}
ES2017โ
| Feature | Description | Link |
|---|---|---|
async / await | Syntactic sugar for promise-based async code | MDN |
Object.values / Object.entries | Get own enumerable values or [key, value] pairs | MDN |
String.prototype.padStart/padEnd | Pad string to target length | MDN |
Object.getOwnPropertyDescriptors | All own property descriptors for proper cloning | MDN |
SharedArrayBuffer & Atomics | Shared memory for multi-threaded JS | MDN |
| Trailing commas in function params | Allowed in parameter lists and arguments | MDN |
async function fetchData() {
const response = await fetch(url);
return response.json();
}
ES2016โ
| Feature | Description | Link |
|---|---|---|
Array.prototype.includes | Check if array contains element (handles NaN) | MDN |
Exponentiation operator (**) | 2 ** 4 instead of Math.pow(2, 4) | MDN |
[1, 2, NaN].includes(NaN); // true
2 ** 10; // 1024
ES2015 (ES6)โ
Syntaxโ
| Feature | Description | Link |
|---|---|---|
let and const | Block-scoped variable declarations | MDN |
| Arrow functions | () => {} with lexical this | MDN |
| Template literals | `Hello ${name}` โ interpolation and multiline | MDN |
| Destructuring | Extract values from arrays/objects | MDN |
| Default parameters | function f(x = 1) | MDN |
Rest/spread (...) | Rest params and array spread | MDN |
| Classes | class / extends / super | MDN |
Generators (function*) | Pausable functions yielding values | MDN |
Built-insโ
| Feature | Description | Link |
|---|---|---|
| Promises | Built-in async primitives | MDN |
Symbol | New primitive for unique identifiers | MDN |
Map / Set | New collection types | MDN |
WeakMap / WeakSet | GC-friendly collections | MDN |
Proxy / Reflect | Meta-programming via traps | MDN |
Iterators & for...of | Iteration protocol and loop | MDN |
| Typed Arrays | ArrayBuffer, DataView, typed views | MDN |
Object.assign | Shallow-copy/merge objects | MDN |
Array.from / Array.of | Create arrays from iterables or arguments | MDN |
String methods | includes, startsWith, endsWith, repeat | MDN |
Number methods | isFinite, isNaN, isInteger, isSafeInteger | MDN |
Modulesโ
| Feature | Description | Link |
|---|---|---|
import / export | Native ES module system | MDN |
const [first, ...rest] = [1, 2, 3, 4];
const greet = (name = "world") => `Hello, ${name}!`;
class Animal {
constructor(name) { this.name = name; }
speak() { return `${this.name} makes a noise.`; }
}
Further Readingโ
- Exploring JS โ In-depth free books on every ES version by Dr. Axel Rauschmayer
- TC39 Proposals โ Track upcoming JavaScript features
- What's new in ECMAScript โ Paweล Grzybek's annual feature roundup
- JavaScript & TypeScript โ Learning resources for JS and TS