ECMAScript 2026
New Features in JavaScript 2026
ECMAScript 2026 introduces several features focused on improving resource management, handling asynchronous operations, and enhancing data manipulation:
- New JavaScript Date Object -
Temporal Date - Resource management with
usingandawait using - Error detection with
Error.isError() - Asynchronous array creation with
Array.fromAsync() - Base64 and hexadecimal encodings for
Uint8Array - Immutability with Records & Tuples (Stage 3 proposal)
- Pattern Matching (Stage 3 proposal)
The Temporal API
The Temporal API in JavaScrit 2026 provides standard objects and functions for working with dates and times.
From ES2026, the Temporal API is the standard for modern date and time management in JavaScript, designed to replace the legacy Date object.
Unlike Date, Temporal objects are immutable and provide first-class support for time zones and non-Gregorian calendars.
Resource Management with using
JavaScript 2026 added two keywords to automatically manage and dispose resources (like file handles or database connections) when they go out of scope, reducing the need for explicit try...finally blocks.
usingprovides synchronous cleanup of block-scoped variables.await usingprovides asynchronous cleanup for resources like network streams.
Error Detection with Error.isError()
Error.isError() is a static method to reliably check if a value is an Error object,
improving error handling and debugging.
New Array with 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.
New Uint8Array Methods in ES2026
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.
Uint8Array fromBase64()
Creates a Uint8Array object from a base64-encoded string Uint8Array toBase64()
Returns a base64-encoded string from the data in an int8Array Uint8Array fromHex()
Creates a Uint8Array object from a hexadecimal string Uint8Array toHex()
Returns a hex-encoded string from the data in an int8Array
Warning
The 2026 edition is not published yet. It normally ships in June.
As of November 2025, this is a list of the features in the draft, that is likely to be in the ES2026.
Explicit Resource Management
The using Keyword
The
usingkeyword is an addition to JavaScript 2026. It provides a mechanism for managing resources that require explicit disposal.It declares a block-scoped variable, similar to
const, but with the difference that it guarantees synchronous disposal of the used resource when the variable goes out of scope.Example
class MyResource {Try it Yourself »
constructor(name) {
this.name = name;
myDisplay(`Resource ${this.name} acquired.`);
}
[Symbol.dispose]() {
myDisplay(`Resource ${this.name} disposed.`);
}
}
function manageResource() {
using resource = new MyResource("Database Connection");
// Use the resource here
myDisplay(`Using resource: ${resource.name}`);
}
The
usingkeyword simplifies resource management by automatically handling the cleanup process, reducing the risk of resource leaks and improving code readability compared to manualtry...finallyblocks for disposal.Resource Management
usingis designed for objects that implement theSymbol.disposemethod, which defines the cleanup logic for the resource.Synchronous Disposal
When a variable declared withusingexits its scope (at the end of a block or function), itsSymbol.disposemethod is automatically called.Asynchronous Disposal
For resources requiring asynchronous cleanup, theawait usingdeclaration can be employed. This ensures that the disposal process is awaited before the variable fully goes out of scope.Block-Scoped
Likeconst, variables declared withusingare local to the block in which they are declared, and must be initialized at the time of declaration.Immutable
Like toconst, variables declared withusingcannot be reassigned after initialization.
Browser Support
usingis already supported in many browsers:Chrome
134Edge
134Firefox
141Safari
❌Opera
119Mar 2025 Mar 2025 Jul 2025 ❌ May 2025
Explicit Resource Management
await using
Inspired by other languages, JavaScript 2026 introduces
usingblocks for automatic cleanup of resources like file handles, database connections, or network streams.This is especially beneficial for asynchronous operations:
Example
async function processFile() {Try it Yourself »
using fileHandle = await openFile('data.txt');
// Work with fileHandle here
} // fileHandle is automatically closed here
Browser Support
await usingis already supported in many browsers:Chrome
134Edge
134Firefox
141Safari
❌Opera
119Mar 2025 Mar 2025 Jul 2025 ❌ May 2025
Error.isError()
The
Error.isError()static method checks whether a value is an Error object.Example
Error.isError(new TypeError()); // trueTry it Yourself »
Error.isError({ name: "Error" }); // false
Error.isError()is a safe alternative toinstanceof Errorwhich fails across realms.Realm-safe error check:
An Error from an iframe verifies withError.isError()and fails withinstanceof.Browser Support
Error.isError()is already supported in many browsers:Chrome
134Edge
134Firefox
138Safari
❌Opera
119Mar 2025 Mar 2025 Apr 2025 ❌ May 2025
Array.fromAsync()
Example
async function* asyncGenerator() {Try it Yourself »
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 already supported in many browsers:Chrome
121Edge
121Firefox
115Safari
16.4Opera
❌Jan 2024 Jan 2024 Jul 2023 May 2023 ❌
Uint8Array to/fromBase64()
Examples
let string = 'W3Schools 123';Try it Yourself »
const arr = Uint8Array.fromBase64(string);const arr = new Uint8Array([91,116,156,134,138,37,179,93,183]);Try it Yourself »
let text = arr.toBase64();Browser Support
to/fromBase64()is already supported in many browsers:Chrome
140Edge
140Firefox
133Safari
18.2Opera
❌Sep 2025 Sep 2025 Nov 2024 Des 2024 ❌
Uint8Array to/fromHex()
Examples
let text = '5b749c868a25b35db7';Try it Yourself »
const arr = Uint8Array.fromHex(text);const arr = new Uint8Array([91,116,156,134,138,37,179,93,183]);Try it Yourself »
let text = arr.toHex();Browser Support
to/fromHex()is already supported in many browsers:Chrome
140Edge
140Firefox
133Safari
18.2Opera
❌Sep 2025 Sep 2025 Nov 2024 Des 2024 ❌
-->