Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP W3.CSS C C++ C# HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS

JS Tutorial

JS Home JS Introduction JS Where To JS Output JS Syntax JS Operators JS If Conditions JS Loops JS Strings JS Numbers JS Functions JS Timers JS Objects JS Scope JS Dates JS Temporal  New JS Arrays JS Sets JS Maps JS Iterations JS Math JS RegExp JS Data Types JS Errors JS Debugging JS Style Guide JS Reference JS Projects  New JS Versions JS HTML DOM JS HTML Events JS HTML First

JS Advanced

JS Functions JS Objects JS Classes JS JSON JS Asynchronous JS Modules JS Meta & Proxy JS Typed Arrays JS DOM Navigation JS Browser API JS Web API JS Graphics

Old Technologies

JS AJAX JS jQuery JS JSONP

JS Examples

JS Examples

ECMAScript 2026

New Features in JavaScript 2026

ECMAScript 2026 (ES2026), the 17th edition of the JavaScript language specification, was officially ratified by ECMA International on June 30, 2026.

Features Pushed to ES2027

While highly visible in the ecosystem through mature polyfills, a couple of major proposals just missed the June 2026 cutoff for official inclusion and are officially slated for next year's spec:

  • Temporal API
    The long-time-overdue successor to the buggy, 30-year-old Date object. Unlike Date, Temporal objects are immutable and provide first-class support for time zones and non-Gregorian calendars.

  • Explicit Resource Management (using keyword)
    C#-style block-scoped disposal variables that auto-clean up database connections and streams when leaving context, avoiding try...finally boilerplate.

Accurate Math with Math.sumPrecise()

Math.sumPrecise() fixes the classic 0.1 + 0.2 === 0.30000000000000004 floating-point problem when summing lists of numbers.

Computers do not think in base-10 decimals like humans; they think in binary bits, which causes structural math flaws in programming.

The Problem: In JavaScript, 0.1 + 0.2 has historically equaled 0.30000000000000004 due to floating-point rounding errors. This is dangerous for financial apps.

The Fix: Math.sumPrecise changes how the underlying language engine calculates a list of decimals, bypassing the system's structural limitation to deliver a perfect sum.


Map Upsert with getOrInsert()

Map.prototype.getOrInsert removes the boilerplate of checking if a key exists before adding an item to a Map structure.

A data structure (like an Array or a Map) holds your information. Previously, JavaScript's built-in structures lacked common-sense shortcuts found in other languages.

The Problem: If you wanted to update a dictionary (Map), you had to write an if statement to check if the key existed, create it if missing, and then update it.

The Fix: Map.prototype.getOrInsert lets you find or create data in one quick move. It expands what the data structure can do natively.

Example

const userRoles = new Map();

// Old Way: Multi-line checks
if (!userRoles.has("admin")) {
  userRoles.set("admin", []);
}
userRoles.get("admin").push("Alice");

// New ES2026 Way: Single-line default insertion
userRoles.getOrInsert("admin", []).push("Bob");
userRoles.getOrInsert("admin", []).push("Charlie");

console.log(userRoles.get("admin")); // ['Bob', 'Charlie']

High-Precision JSON with rawJSON()

JSON.rawJSON preserves large numbers (like ID strings from databases) without losing digits due to internal rounding.

Example

const precisionLossJSON = '{"id": 9223372036854775807}';

// New ES2026 Reviver: Accesses the raw source string before rounding
const data = JSON.parse(precisionLossJSON, (key, value, context) => {
  if (key === 'id') {
    return context.source; // "9223372036854775807" as a string
  }
  return value;
});

// New ES2026 Stringify: Outputs the unrounded big integer safely
const output = JSON.stringify({
  id: JSON.rawJSON("9223372036854775807")
});


Error.isError()

Error.isError() is a static method to reliably check if a value is an Error object, improving error handling and debugging.

Error.isError() reliably detects error objects even if they originated from inside an <iframe> or a separate runtime sandbox.

Example

Error.isError(new TypeError()); // true
Error.isError({ name: "Error" }); // false
Try it Yourself »

Realm-safe error check:
An Error from an iframe verifies with Error.isError() and fails with instanceof.

Example

Error.isError() is a safe alternative to instanceof Error which fails across realms.

try {
  throw new TypeError("Invalid format");
} catch (err) {
  // Old Way: Could fail across different window contexts
  console.log(err instanceof Error);

  // New ES2026 Way: Globally reliable
  console.log(Error.isError(err)); // true
}

Browser Support

Error.isError() is already supported in many browsers:

Chrome
134
Edge
134
Firefox
138
Safari
Opera
119
Mar 2025 Mar 2025 Apr 2025 May 2025

Array.fromAsync()

Array.fromAsync() is a feature that allows developers to create a new Array instance from asynchronous iterables, array-like objects, or Promises, streamlining the handling of data from async sources.

Example

// An async generator simulating a paginated API
async function* fetchPages() {
  yield;
  yield;
}

// New ES2026 Way: Resolves and flattens natively
const allData = await Array.fromAsync(fetchPages(), flatMap => flatMap);
console.log(allData); // [1, 2, 3, 4]

Example

async function* asyncGenerator() {
  yield Promise.resolve(1);
  yield Promise.resolve(2);
  yield Promise.resolve(3);
}

async function processAsyncData() {
  const arr = await Array.fromAsync(asyncGenerator());
}

processAsyncData();
Try it Yourself »

Browser Support

Array.fromAsync() is supported in all major browsers:

Chrome
121
Edge
121
Firefox
115
Safari
16.4
Opera
107
Jan 2024 Jan 2024 Jul 2023 May 2023 Feb 2024

New Uint8Array Methods

Base64 and Hexadecimal Encodings for Uint8Array.

These new static methods facilitate working with binary data by adding direct conversion between Uint8Array objects and Base64 or hexadecimal strings.

This eliminates the need for external buffer modules or hacky window methods like btoa() and atob().

Uint8Array to/fromBase64()

Examples

// Creating raw binary data
const bytes = new Uint8Array([72, 101, 108, 108, 111]); // "Hello"

// New ES2026: Direct string conversions
const base64String = bytes.toBase64();
console.log(base64String); // "SGVsbG8="

const hexString = bytes.toHex();
console.log(hexString); // "48656c6c6f"

// Reversing the operation
const restoredBytes = Uint8Array.fromBase64("SGVsbG8=");
let string = 'W3Schools 123';

const arr = Uint8Array.fromBase64(string);
Try it Yourself »
const arr = new Uint8Array([91,116,156,134,138,37,179,93,183]);

let text = arr.toBase64();
Try it Yourself »

Browser Support

to/fromBase64() is supported in all major browsers:

Chrome
140
Edge
140
Firefox
133
Safari
18.2
Opera
124
Sep 2025 Sep 2025 Nov 2024 Des 2024 Nov 2024

Uint8Array to/fromHex()

Examples

let text = '5b749c868a25b35db7';

const arr = Uint8Array.fromHex(text);
Try it Yourself »
const arr = new Uint8Array([91,116,156,134,138,37,179,93,183]);

let text = arr.toHex();
Try it Yourself »

Browser Support

to/fromHex() is supported in all major browsers:

Chrome
140
Edge
140
Firefox
133
Safari
18.2
Opera
124
Sep 2025 Sep 2025 Nov 2024 Des 2024 Nov 2025

Accurate Floating-Point Math

The Math.sumPrecise() Method fixes the classic 0.1 + 0.2 === 0.30000000000000004 floating-point problem when summing lists of numbers.

Example

// Old Way: Inaccuracies accumulate
const items = [0.1, 0.2, 0.3];
const badSum = items.reduce((a, b) => a + b, 0);
myDisplayer(badSum);

// New ES2026 Way: Perfectly precise
const preciseSum = Math.sumPrecise(items);
myDisplayer(preciseSum);
Try it Yourself »

Browser Support

Math.sumPrecise() is supported in all major browsers:

Chrome
147
Edge
147
Firefox
137
Safari
26.2
Opera
131;
Apr 2026 Apr 2026 Apr 2025 Nov 2025 Apr 2026


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.

-->