api: YAML JSON TOON Database
version: 1.0.0
format: json
dataset:
  id: 11
  slug: javascript-es6-features
  title: JavaScript ES6+ Features Reference
  description: "Key JavaScript features from ES6 through ES2022: arrow functions, template literals, destructuring, spread, async/await, optional chaining, nullish coalescing, and top-level await."
  summary: "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_when:
    - You need the ECMAScript version that introduced a feature and its syntax.
    - You are deciding what a browser or Node version supports.
  caveats:
    - 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.
  related:
    - typescript-type-system
    - browser-web-apis-reference
    - javascript-frameworks-comparison
    - language-comparison-2026
  category: Programming Languages
  category_slug: programming-languages
  tags: javascript,es6,web,reference
  view_count: 0
  created_at: 1777673262
  updated_at: 1777673262
  entry_count: 20
  fields:
    - section: features
      field: name
      type: string
      example: Arrow Functions
    - section: features
      field: version
      type: string
      example: ES6 (2015)
    - section: features
      field: description
      type: string
      example: Concise function syntax with lexical this bindi…
    - section: features
      field: example
      type: string
      example: const add = (a, b) => a + b;
data:
  features:
    - name: Arrow Functions
      version: ES6 (2015)
      description: Concise function syntax with lexical this binding
      example: const add = (a, b) => a + b;
    - name: Template Literals
      version: ES6 (2015)
      description: String interpolation with backticks and ${}
      example: "`Hello, ${name}!`"
    - name: Destructuring
      version: ES6 (2015)
      description: Unpack values from arrays or objects into variables
      example: const {name, age} = person;
    - name: Spread Operator
      version: ES6 (2015)
      description: Expand iterables into individual elements
      example: const merged = [...arr1, ...arr2];
    - name: Async/Await
      version: ES8 (2017)
      description: Syntactic sugar over Promises for async code
      example: const data = await fetch(url);
    - name: Optional Chaining
      version: ES2020
      description: Safe nested property access without null check
      example: user?.profile?.name
    - name: Nullish Coalescing
      version: ES2020
      description: Fallback for null/undefined only (not falsy)
      example: const x = value ?? defaultValue;
    - name: Top-level Await
      version: ES2022
      description: Use await outside async functions in modules
      example: const config = await loadConfig();
    - name: Classes
      version: ES6 (2015)
      description: Syntax for constructor functions and prototype-based inheritance
      example: class Animal { constructor(name) { this.name = name; } speak() { return this.name; } }
    - name: Modules
      version: ES6 (2015)
      description: Standard import and export of code between files
      example: import { add } from './math.js'; export const pi = 3.14;
    - name: Promises
      version: ES6 (2015)
      description: Objects representing the eventual result of an asynchronous operation
      example: fetch(url).then(res => res.json()).catch(console.error)
    - name: Generators
      version: ES6 (2015)
      description: Functions that can pause and resume, producing a sequence of values
      example: function* count() { yield 1; yield 2; }
    - name: Map and Set
      version: ES6 (2015)
      description: Collections with arbitrary keys and unique values
      example: const m = new Map([['a', 1]]); const s = new Set([1, 2, 2]);
    - name: Array.prototype.flat and flatMap
      version: ES2019
      description: Flatten nested arrays and map then flatten
      example: "[1, [2, [3]]].flat(2) // [1, 2, 3]"
    - name: Object.fromEntries
      version: ES2019
      description: Builds an object from key-value pairs
      example: "Object.fromEntries([['a', 1], ['b', 2]]) // { a: 1, b: 2 }"
    - name: BigInt
      version: ES2020
      description: Arbitrary-precision integers
      example: 2n ** 64n
    - name: Logical Assignment
      version: ES2021
      description: Combine logical operators with assignment
      example: a ||= 1; b &&= 2; c ??= 3;
    - name: Private Class Fields
      version: ES2022
      description: Fields that are only accessible inside the class
      example: "class C { #secret = 1; get() { return this.#secret; } }"
    - name: Array.prototype.at
      version: ES2022
      description: Index with negative positions counting from the end
      example: "[10, 20, 30].at(-1) // 30"
    - name: Array.prototype.toSorted
      version: ES2023
      description: Sort a copy of an array without mutating it
      example: const sorted = arr.toSorted((a, b) => a - b);
