53 changes · 0 breaking
01Strict ModeES5

"use strict" opts into a restricted variant that catches silent errors.

javascript
"use strict";
x = 10; // ReferenceError — undeclared variable
02Array MethodsES5

forEach, map, filter, reduce, some, every, indexOf added to Array.prototype.

javascript
[1, 2, 3].map(n => n * 2); // [2, 4, 6]
[1, 2, 3].filter(n => n > 1); // [2, 3]
03JSON SupportES5

Native JSON.parse() and JSON.stringify() built into the language.

javascript
JSON.stringify({ a: 1 }); // '{"a":1}'
JSON.parse('{"a":1}'); // { a: 1 }
04Object MethodsES5

Object.create, Object.keys, Object.defineProperty, Object.freeze introduced.

javascript
const obj = Object.create(null); // no prototype
Object.keys({ a: 1, b: 2 }); // ['a', 'b']
05let & constES2015 (ES6)

Block-scoped variable declarations replacing the pitfalls of var.

javascript
let x = 1;
const PI = 3.14;
06Arrow FunctionsES2015 (ES6)

Concise syntax with lexical this binding.

javascript
const double = n => n * 2;
07ClassesES2015 (ES6)

Syntactic sugar over prototype-based inheritance.

javascript
class Animal { constructor(name) { this.name = name; } }
08Template LiteralsES2015 (ES6)

String interpolation and multi-line strings with backticks.

javascript
const msg = `Hello, ${name}!`;
09Destructuring, Spread, RestES2015 (ES6)

Concise patterns for extracting and combining data.

javascript
const { a, b } = obj;
const arr = [...a, ...b];
10PromisesES2015 (ES6)

Native asynchronous abstraction replacing callback hell.

javascript
fetch('/api').then(r => r.json()).catch(console.error);
11Modules (import/export)ES2015 (ES6)

Static module system with named and default exports.

javascript
import { add } from './math.js';
export default function main() {}
12Map, Set, WeakMap, WeakSetES2015 (ES6)

New built-in collection types.

javascript
const s = new Set([1, 2, 2]); // {1, 2}
13SymbolES2015 (ES6)

Unique, immutable primitive for non-colliding property keys.

javascript
const id = Symbol('id');
14Iterators & GeneratorsES2015 (ES6)

Custom iterable protocol and pausable function execution.

javascript
function* gen() { yield 1; yield 2; }
15Proxy & ReflectES2015 (ES6)

Intercept and redefine fundamental object operations.

javascript
const p = new Proxy(target, { get(obj, key) { ... } });
16Exponentiation Operator (**)ES2016

Concise power operator.

javascript
2 ** 10; // 1024
17Array.prototype.includesES2016

Check if an array contains a value (handles NaN correctly, unlike indexOf).

javascript
[1, NaN, 3].includes(NaN); // true
18async / awaitES2017

Syntactic sugar over Promises for sequential async code.

javascript
async function load() {
const data = await fetch('/api').then(r => r.json());
return data;
}
19Object.entries / Object.valuesES2017

Iterate over object key-value pairs or values directly.

javascript
Object.entries({ a: 1, b: 2 }); // [['a',1],['b',2]]
20String Padding (padStart / padEnd)ES2017

Pad strings to a target length.

javascript
'5'.padStart(3, '0'); // '005'
21Trailing Commas in FunctionsES2017

Trailing commas now allowed in function parameter and argument lists.

javascript
function f(a, b,) {} // valid
22Object Rest/SpreadES2018

Spread and rest operators extended to object literals.

javascript
const { a, ...rest } = { a: 1, b: 2, c: 3 };
const merged = { ...obj1, ...obj2 };
23Promise.finallyES2018

Run cleanup code after a promise settles regardless of outcome.

javascript
fetch('/api').then(handle).catch(log).finally(cleanup);
24Async IterationES2018

for-await-of loop and async generators for async data streams.

javascript
for await (const chunk of stream) { process(chunk); }
25Named Capture GroupsES2018

Named regex groups for readable captures.

javascript
const { year, month } = '2024-05'.match(/(?<year>\d{4})-(?<month>\d{2})/).groups;
26Array.flat / flatMapES2019

Flatten nested arrays and map+flatten in one pass.

javascript
[[1, 2], [3]].flat(); // [1, 2, 3]
[1, 2, 3].flatMap(n => [n, n]); // [1,1,2,2,3,3]
27Object.fromEntriesES2019

Convert key-value pairs back into an object (inverse of Object.entries).

javascript
Object.fromEntries([['a', 1], ['b', 2]]); // {a:1, b:2}
28String.trimStart / trimEndES2019

Trim whitespace from a specific end of a string.

javascript
' hi '.trimStart(); // 'hi '
29Optional catch bindingES2019

Omit the error parameter in catch when not needed.

javascript
try { ... } catch { /* no (err) required */ }
30Optional Chaining (?.)ES2020

Safely navigate nested object properties without null checks.

javascript
user?.address?.city ?? 'Unknown'
31Nullish Coalescing (??)ES2020

Default values only for null/undefined (not other falsy values).

javascript
const port = config.port ?? 3000;
32Promise.allSettledES2020

Resolves when all promises settle, returning status + value/reason for each.

javascript
const results = await Promise.allSettled([p1, p2]);
33BigIntES2020

Arbitrary-precision integers beyond Number.MAX_SAFE_INTEGER.

javascript
const big = 9007199254740993n; // note the n suffix
34Dynamic import()ES2020

Lazy-load ES modules on demand.

javascript
const { add } = await import('./math.js');
35globalThisES2020

Universal reference to the global object across environments.

javascript
globalThis.fetch; // works in browser and Node.js
36Logical Assignment (??=, ||=, &&=)ES2021

Combine logical operators with assignment.

javascript
cache[key] ??= compute(key);
user.name ||= 'Anonymous';
37Promise.anyES2021

Resolves with the first fulfilled promise; rejects if all reject.

javascript
const fastest = await Promise.any([mirror1, mirror2]);
38String.replaceAllES2021

Replace all occurrences without a regex.

javascript
'aabbcc'.replaceAll('b', 'x'); // 'aaxxcc'
39Numeric SeparatorsES2021

Underscores as visual separators in numeric literals.

javascript
const billion = 1_000_000_000;
40WeakRef & FinalizationRegistryES2021

Weakly hold object references and register cleanup callbacks.

javascript
const ref = new WeakRef(target);
ref.deref()?.method();
41Class Fields & Private (#)ES2022

Declare instance fields and private members directly in the class body.

javascript
class Counter {
#count = 0;
inc() { this.#count++; }
}
42Top-level awaitES2022

Use await at the top level of ES modules without an async wrapper.

javascript
const data = await fetch('/api').then(r => r.json());
43Array.at / String.atES2022

Access elements by index with negative index support.

javascript
[1, 2, 3].at(-1); // 3
44Object.hasOwnES2022

Safe replacement for hasOwnProperty.

javascript
Object.hasOwn(obj, 'key'); // true/false
45Error.causeES2022

Chain errors with a cause property for better diagnostics.

javascript
throw new Error('Load failed', { cause: originalError });
46Array findLast / findLastIndexES2023

Search from the end of an array.

javascript
[1, 2, 3, 2].findLast(n => n === 2); // 2 (last match)
47Array toSorted / toReversed / toSpliced / withES2023

Non-mutating versions of sort, reverse, splice, and index assignment.

javascript
const sorted = arr.toSorted(); // arr unchanged
const updated = arr.with(1, 99); // new array, index 1 = 99
48Hashbang GrammarES2023

Shebangs (#!) at the start of scripts are now part of the spec.

javascript
#!/usr/bin/env node
49WeakMap with Symbol keysES2023

Symbols can now be used as WeakMap keys.

javascript
const wm = new WeakMap();
wm.set(Symbol('key'), value);
50Promise.withResolversES2024

Create a promise with its resolve/reject exposed — cleaner than the constructor pattern.

javascript
const { promise, resolve, reject } = Promise.withResolvers();
setTimeout(resolve, 1000, 'done');
51Object.groupBy / Map.groupByES2024

Group iterables by a key function without a manual reduce.

javascript
const grouped = Object.groupBy(items, item => item.type);
// { 'fruit': [...], 'veggie': [...] }
52ArrayBuffer.transferES2024

Move ownership of an ArrayBuffer to a new one, detaching the old.

javascript
const newBuf = buf.transfer(newByteLength);
53Regex /v flag (Unicode Sets)ES2024

Enhanced Unicode regex with set notation and string properties.

javascript
/[\p{Decimal_Number}--[0-9]]/v.test('٢'); // true