ECMAScript 2025 was officially announced and approved on June 25, 2025, by the 129th ECMA General Assembly.
Here are the new key features that were introduced with the launch of ECMAScript 2025-
Import Attributes and Modules
Now we can now import JSON files as modules directly, with an optional { type: 'json' } attribute to specify the kind of import.
For example,
import data from './data.json' with { type: 'json' };
Iterator Helper Methods
Iterators now have common array-like methods—for instance, map(), filter(), take(), and drop()—which return new iterators.
const itr = [1, 2, 3, 4, 5].values();
const filtered = itr.filter(x => x % 2 === 1).map(x => x * 2).toArray();
console.log(filtered); // [2, 6, 10]
New Set Methods
Now, Sets have gained convenient methods to perform set operations like union, intersection, difference, and symmetric difference.
const a = new Set([1, 2, 3]);
const b = new Set([2, 3, 4]);
const union = a.union(b);
console.log([...union]); // [1, 2, 3, 4]
Promise.try()
It brings up a convenient method to wrap synchronous functions in promises, easing asynchronous coding. It simplifies promise handling for functions that may throw or return synchronous values.
Promise.try(() => {
if (somethingWrong) throw new Error("Oops");
return 42;
}).then(console.log).catch(console.error);
Float16Array and Math.f16round()
ES2025 brings new support for 16-bit floating-point numbers; Float16Array typed arrays and rounding utilities.
It is useful for performance and memory savings in graphics, machine learning, and WebAssembly contexts.
const f16arr = new Float16Array([1.1, 2.2, 3.3]);
console.log(f16arr); // [1.099609375, 2.19921875,
3.30078125]
String.prototype.isWellFormed() and toWellFormed()
Check if a string is well-formed UTF-16 (no unmatched surrogate pairs) and convert to a well-formed string.
Helps avoid bugs related to improperly encoded strings.
const str = "hello\uD800";
console.log(str.isWellFormed()); // false
const fixedStr = str.toWellFormed();
console.log(fixedStr.isWellFormed()); // true
Object.groupBy() and Map.groupBy()
New methods to group array or iterable items by a key function, producing objects or maps keyed by group. These simplify data aggregation and categorization tasks.
const people = [{age: 20}, {age: 21}, {age: 20}];
const grouped = Object.groupBy(people, p => p.age);
console.log(grouped);
// {20: [{age: 20}, {age: 20}], 21: [{age: 21}]}
Memory Management Improvements
Enhancements around WeakRef and FinalizationRegistry APIs for better handling of object lifecycle and cleanup, useful in caching or resource management.
Pattern Matching (Upcoming feature)
A new syntax allowing expressive and concise conditional structures that destructure and match values against patterns. Inspired by functional languages, this simplifies complex branching logic.
Records and Tuples (Upcoming)
Introducing immutable, deeply frozen data structures that are efficient for functional programming. These structures can be used as Map keys without mutation issues.