JavaScript ES6+ Features Reference

Key JavaScript features from ES6 through ES2022: arrow functions, template literals, destructuring, spread, async/await, optional chaining, nullish coalescing, and top-level await.

  • JSON7,809 B
  • YAML5,359 B · −31%
  • TOON4,068 B · −48%

JavaScript features introduced from ES2015 onward, each with the version and an example: arrow functions, template literals, destructuring, spread, async/await, optional chaining, nullish coalescing and top-level await, plus classes, modules, promises, generators, maps and sets, BigInt, private fields and newer array methods.

Use it when

  • You need the ECMAScript version that introduced a feature and its syntax.
  • You are deciding what a browser or Node version supports.

Watch out for

  • Browser and runtime support lags the specification; check compatibility tables or a transpiler configuration.
  • Newer proposals appear on the standards track before they are final; the list covers shipped features.

The data

Features

NameVersionDescriptionExample
Arrow FunctionsES6 (2015)Concise function syntax with lexical this bindingconst add = (a, b) => a + b;
Template LiteralsES6 (2015)String interpolation with backticks and ${}`Hello, ${name}!`
DestructuringES6 (2015)Unpack values from arrays or objects into variablesconst {name, age} = person;
Spread OperatorES6 (2015)Expand iterables into individual elementsconst merged = [...arr1, ...arr2];
Async/AwaitES8 (2017)Syntactic sugar over Promises for async codeconst data = await fetch(url);
Optional ChainingES2020Safe nested property access without null checkuser?.profile?.name
Nullish CoalescingES2020Fallback for null/undefined only (not falsy)const x = value ?? defaultValue;
Top-level AwaitES2022Use await outside async functions in modulesconst config = await loadConfig();
ClassesES6 (2015)Syntax for constructor functions and prototype-based inheritanceclass Animal { constructor(name) { this.name = name; } speak() { return this.name; } }
ModulesES6 (2015)Standard import and export of code between filesimport { add } from './math.js'; export const pi = 3.14;
PromisesES6 (2015)Objects representing the eventual result of an asynchronous operationfetch(url).then(res => res.json()).catch(console.error)
GeneratorsES6 (2015)Functions that can pause and resume, producing a sequence of valuesfunction* count() { yield 1; yield 2; }
Map and SetES6 (2015)Collections with arbitrary keys and unique valuesconst m = new Map([['a', 1]]); const s = new Set([1, 2, 2]);
Array.prototype.flat and flatMapES2019Flatten nested arrays and map then flatten[1, [2, [3]]].flat(2) // [1, 2, 3]
Object.fromEntriesES2019Builds an object from key-value pairsObject.fromEntries([['a', 1], ['b', 2]]) // { a: 1, b: 2 }
BigIntES2020Arbitrary-precision integers2n ** 64n
Logical AssignmentES2021Combine logical operators with assignmenta ||= 1; b &&= 2; c ??= 3;
Private Class FieldsES2022Fields that are only accessible inside the classclass C { #secret = 1; get() { return this.#secret; } }
Array.prototype.atES2022Index with negative positions counting from the end[10, 20, 30].at(-1) // 30
Array.prototype.toSortedES2023Sort a copy of an array without mutating itconst sorted = arr.toSorted((a, b) => a - b);

Fields

The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.

SectionFieldTypeExample
featuresnamestringArrow Functions
featuresversionstringES6 (2015)
featuresdescriptionstringConcise function syntax with lexical this bindi…
featuresexamplestringconst add = (a, b) => a + b;

Fetch the same bytes

The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.

curl "https://yjtoon.com/api/dataset/javascript-es6-features?format=toon"
const res = await fetch(
  "https://yjtoon.com/static-data/dataset/javascript-es6-features.toon"
);
const toon = await res.text();

Rate limit: 120 requests per minute per IP, no key and no signup. API reference →

Topics

  • javascript
  • es6
  • web
  • reference

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets