ECMAScript – Features

List of some of the major features introduced in each version of ECMAScript:

ECMAScript 1 (1997)

  • Variables and datatypes (e.g. strings, numbers, booleans)
  • Control structures (e.g. if/else statements, loops)
  • Functions and function scope
  • Prototypes

ECMAScript 2 (1998)

  • Minor updates and bug fixes

ECMAScript 3 (1999)

  • Regular expressions
  • try/catch exception handling
  • New array methods (e.g. map(), filter(), reduce())
  • JSON support
  • Functions as first-class objects

ECMAScript 4 (never released)

  • Classes and interfaces
  • Generators
  • Better syntax for defining functions and objects
  • Improved support for concurrency

ECMAScript 5 (2009) – Examples

  • Strict mode for better error handling and performance optimization
  • JSON improvements (e.g. JSON.stringify(), JSON.parse())
  • Array methods (e.g. forEach(), indexOf(), lastIndexOf())
  • Getter and setter methods
  • New methods for built-in objects (e.g. Object.keys())

ECMAScript 6 (2015) – Examples and W3 Examples

  • let and const keywords for block-scoped variables
  • Arrow functions
  • Template literals for easier string interpolation
  • Classes and modules
  • Destructuring assignment
  • Default function parameters
  • Rest and spread operators for arrays and objects
  • Promises for asynchronous programming
  • Symbols for unique object keys
  • Iterators and generators

ECMAScript 7 (2016) – Examples

  • Array includes() method
  • Exponentiation operator (e.g. 2 ** 3 = 8)
  • Array and object destructuring improvements
  • Rest and spread operators for object properties

ECMAScript 8 (2017) – Examples

  • Async functions for cleaner asynchronous programming
  • Object entries() and values() methods
  • String padding methods
  • Object property order

ECMAScript 9 (2018) – Examples

  • Asynchronous iteration with for-await-of loop
  • Rest and spread properties for objects
  • Promise.prototype.finally() method

ECMAScript 10 (2019) – Examples

  • Array.flat() and Array.flatMap() methods
  • Object.fromEntries() method
  • Optional catch binding in try/catch statements
  • Symbol.description property

ECMAScript 11 (2020) – Examples

  • Optional chaining operator (?.)
  • Nullish coalescing operator (??)

ECMAScript 12 (2021/22) – Examples

  • Private class methods and fields
  • Logical assignment operators (e.g. &&=, ||=)

ECMAScript 14 (2023) – Examples

  • findLast – The findLast() method searches for a value in an array by iterating through the elements in reverse order. It returns the value of the first element that meets the condition specified by a testing function. If no element satisfies the condition, it returns undefined.
  • findLastIndex – The findLastIndex() method searches for a value in an array by iterating through the elements in reverse order. It returns the index of the first element that meets the condition specified by a testing function. If no element satisfies the condition, it returns -1.
  • Hasbang Grammar – Hashbangs (also known as Shebangs), which are directives typically found at the beginning of Unix-based scripts that determine the interpreter for the script.
  • Symbols as WeakMap Keys – Symbols can be employed as keys in WeakMaps, enhancing their versatility. Previously, only Objects were allowed as WeakMap keys, but Symbols, with their uniqueness and non-duplicability, now provide an excellent alternative. This update enables more efficient memory management with WeakMaps and broadens the scope of applications where Symbols can be utilized effectively.

Each new version of ECMAScript has added new features and improved upon existing ones, making it easier and more efficient to write complex web applications.

You might also like