J

JavaScript Handbook

Clean • Professional

JavaScript Versions & Standards

3 minute

JavaScript Versions & Standards: ES5 to ES2025

JavaScript has evolved over the years through ECMAScript (ES) standards, which define the language’s syntax, features, and behavior. Each version introduced new capabilities, improved performance, and enhanced error handling.

learn code with durgesh images

ES1 (1997)

The first official ECMAScript version.

  • Introduced basic syntax, data types, loops, and functions.
  • Error handling: Basic try-catch support using the Error object.

Example:

try {
  throw new Error("An error occurred");
} catch (e) {
  console.log(e.message); // Output: An error occurred
}

ES2 (1998)

  • Editorial changes to align with ISO standards.
  • Error handling: Remained basic, no new features.

ES3 (1999)

  • Introduced regular expressions, improved string methods, and robust error types like TypeError and ReferenceError.
  • Error handling: Added the finally block for cleanup after try-catch.

Example:

try {
  let x = y; // y is undefined
} catch (e) {
  console.log(e.name); // ReferenceError
} finally {
  console.log("Cleanup done");
}

ES5 (2009)

  • Added strict mode to enforce safer coding practices.
  • Introduced JSON support, getters/setters, and Array methods like forEach.
  • Error handling: Enhanced debugging with error.stack and better reporting of undeclared variables.

Example:

"use strict";
try {
  undeclaredVar = 5; // ReferenceError in strict mode
} catch (e) {
  console.log(e.stack);
}

ES6 / ES2015

Major overhaul introducing let/const, arrow functions, classes, modules, template literals, Promises, Map/Set, and Symbols.

Error handling:

  • Custom error classes
  • Promises allow .catch() for async error handling

Example:

class CustomError extends Error {
  constructor(message) {
    super(message);
    this.name = "CustomError";
  }
}

const promise = Promise.reject(new CustomError("Failed"));
promise.catch(e => console.log(e.name, e.message)); // CustomError Failed

ES7 / ES2016

  • Introduced Array.includes() and the exponentiation operator (*).
  • Error handling: Minor changes; Promises usage grew.

Example:

let arr = [1, 2, 3];
console.log(arr.includes(2)); // true
console.log(2 ** 3); // 8

ES8 / ES2017

  • Added async/await to simplify asynchronous code.
  • Added Object.values(), Object.entries(), and string padding methods.
  • Error handling: Async errors can now be managed cleanly with try-catch.

Example:

async function fetchData() {
  try {
    const response = await fetch("<https://invalid-url>");
  } catch (e) {
    console.error("Fetch error:", e.message);
  }
}

ES9 / ES2018

  • Introduced rest/spread properties, asynchronous iteration, and regex improvements.
  • Error handling: Supports for await...of with proper try-catch.

Example:

async function processAsync(iterable) {
  try {
    for await (let item of iterable) {
      console.log(item);
    }
  } catch (e) {
    console.error(e);
  }
}

ES10 / ES2019

  • Added Array.flat(), Array.flatMap(), Object.fromEntries(), trimStart/End.
  • Error handling: Optional catch binding allows catch { } without specifying the error.

Example:

try {
  JSON.parse("invalid");
} catch {
  console.log("Parsing failed"); // No error variable needed
}

ES11 / ES2020

  • Introduced BigInt, optional chaining (?.), nullish coalescing (??), and Promise.allSettled().
  • Error handling: Optional chaining reduces TypeErrors when accessing undefined properties.

Example:

let obj;
console.log(obj?.property); // undefined

ES12 / ES2021

  • Added String.replaceAll(), logical assignment operators, WeakRefs.
  • Error handling: Enhances memory-safe operations and reduces runtime errors.

Example:

let text = "foo bar foo";
console.log(text.replaceAll("foo", "baz")); // baz bar baz

ES13 / ES2022

  • Introduced top-level await, class fields, and Error.cause.
  • Error handling: Error.cause allows linking errors to their root cause.

Example:

try {
  throw new Error("Outer error", { cause: new Error("Inner error") });
} catch (e) {
  console.log(e.message); // Outer error
  console.log(e.cause.message); // Inner error
}

ESNext / Future (2023+)

  • Ongoing yearly updates with features in proposal stages, like pattern matching, pipeline operator, etc.
  • Error handling: Will evolve with new constructs and advanced async patterns.

Article 0 of 0