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.
- Accurate Math with
Math.sumPrecise() - Error detection with
Error.isError() - Asynchronous array creation with
Array.fromAsync() - Map upsert with
getOrInsert() - High-precision JSON with
rawJSON() - Base64 and hexadecimal encodings for
Uint8Array
Note: 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
Example
Error.isError(new TypeError()); // true
Error.isError({ name: "Error" }); // false
Realm-safe error check: An Error from an iframe verifies with Error.isError() and fails with instanceof.
Example
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:
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();
Browser Support
Array.fromAsync() is supported in all major browsers:
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 fromBase64()Creates a Uint8Array object from a base64-encoded stringUint8Array toBase64()Returns a base64-encoded string from the data in an int8ArrayUint8Array fromHex()Creates a Uint8Array object from a hexadecimal stringUint8Array toHex()Returns a hex-encoded string from the data in an int8Array 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); const arr = new Uint8Array([91,116,156,134,138,37,179,93,183]); let text = arr.toBase64(); Browser Supportto/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); const arr = new Uint8Array([91,116,156,134,138,37,179,93,183]); let text = arr.toHex(); Browser Supportto/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 TheMath.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); Browser SupportMath.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
PIXEL CLOUDS LEFT New W3Schools Adventure App Coding fundamentals as a game. Bite-sized lessons and challenges. APP STORE Download on the App Store GOOGLE PLAY GET IT ON Google Play LEARN MORE Learn more » RIGHT Ready to start your journey? Your streak is waiting. +60 XP PLUS SPACES FOR TEACHERS PRACTICE CONTACT US × 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 Top Tutorials HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial Top References HTML Reference CSS Reference JavaScript Reference SQL Reference Python Reference W3.CSS Reference Bootstrap Reference PHP Reference HTML Colors Java Reference AngularJS Reference jQuery Reference Top Examples HTML Examples CSS Examples JavaScript Examples How To Examples SQL Examples Python Examples W3.CSS Examples Bootstrap Examples PHP Examples Java Examples XML Examples jQuery Examples FORUM ABOUT ACADEMY 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. [if lt IE 9]> <![endif]