Posted on

JavaScript New Features from ES5 to ESNext


ECMAScript 5 (2009)

  • Strict Mode ('use strict'): Enforces better coding practices.
  • Array Methods: forEach, map, filter, reduce, some, every.
  • Object Methods: Object.keys(), Object.create().
  • Getter/Setter Properties: Define computed properties.
  • JSON Support: JSON.parse(), JSON.stringify().
  • bind() Method: Binds this to a function.
  • Property Descriptors: Control property attributes like writable, configurable.

ECMAScript 6 (ES6) – 2015

  • let and const: Block-scoped variables.
  • Arrow Functions (=>): Shorter syntax for functions.
  • Template Literals: String interpolation using backticks.
  • Default Parameters: Function parameters with default values.
  • Destructuring: Extract values from objects/arrays.
  • Spread (...) and Rest Parameters: Expanding and collecting values.
  • Classes (class): Syntactic sugar over constructor functions.
  • Modules (import / export): Native module support.
  • Promises: Handle asynchronous operations.
  • Map and Set: New data structures.
  • Generators (function*): Pause and resume execution.

ECMAScript 7 (ES7) – 2016

  • Exponentiation Operator (**): 2 ** 3 === 8.
  • Array.prototype.includes(): Check if an array contains a value.

ECMAScript 8 (ES8) – 2017

  • Async/Await: Simplifies working with Promises.
  • Object Entries and Values: Object.entries(), Object.values().
  • String Padding: padStart(), padEnd().
  • Trailing Commas in Function Parameters: Avoid syntax errors in version control.
  • Shared Memory & Atomics: Multi-threaded JS via SharedArrayBuffer.

ECMAScript 9 (ES9) – 2018

  • Rest/Spread in Objects: { ...obj }.
  • Promise.prototype.finally(): Runs after a Promise resolves/rejects.
  • Asynchronous Iteration (for await...of): Async iterators.

ECMAScript 10 (ES10) – 2019

  • Array.prototype.flat() & flatMap(): Flatten nested arrays.
  • Object.fromEntries(): Convert key-value pairs into objects.
  • Optional Catch Binding: catch { } without explicitly defining an error variable.
  • String Trim Methods: trimStart(), trimEnd().
  • Symbol Description: Symbol('desc').description.

ECMAScript 11 (ES11) – 2020

  • BigInt (123n): Large integer support.
  • Dynamic import(): Asynchronous module loading.
  • Nullish Coalescing (??): x = a ?? 'default'.
  • Optional Chaining (?.): Safe property access.
  • Promise.allSettled(): Resolves after all Promises settle.
  • String matchAll(): Returns all matches in a string.
  • Global This (globalThis): Unified global object access.

ECMAScript 12 (ES12) – 2021

  • Numeric Separators (1_000_000): Improves readability.
  • replaceAll(): Replace all instances in a string.
  • WeakRefs & FinalizationRegistry: Manage memory manually.
  • Logical Assignment (&&=, ||=, ??=): Shorter conditional assignments.

ECMAScript 13 (ES13) – 2022

  • at() Method: Access array elements via negative indices.
  • Object.hasOwn(): Better alternative to hasOwnProperty.
  • Class Private Fields & Methods: #privateField.
  • Top-Level await: await outside async functions.

ECMAScript 14 (ES14) – 2023

  • Array findLast() & findLastIndex(): Find last matching element.
  • Set Methods: union(), intersection(), difference(), symmetricDifference().
  • Hashbang (#!) in Scripts: Support for Unix-style shebangs.
  • Symbols as WeakMap Keys: Improved memory handling.

Upcoming Features (ESNext)

  • Explicit Resource Management (using): Auto-dispose resources.
  • Temporal API: Improved date/time handling.
  • Pipeline Operator (|>): Streamline function chaining.