What's New in ECMAScript 2025

## Metadata
- Author: [[Pawel Grzybek - https://pawelgrzybek.com/]]
- Full Title: What's New in ECMAScript 2025
- Category: #articles
- Document Note: ---
tags: [#ECMAScript, #JavaScript, #WebDevelopment, #Standards, #ES2025, #ESNext, #Programming]
- #ECMAScript
- #ES2025
- #JavaScript
Author: Pawel Grzybek
Source: Pawel Grzybekโs Blog
Reference: [Whatโs new in ECMAScript 2025?](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/)
date created: 2025-07-01 13:20
---
# Title: ๐ Whatโs New in ECMAScript 2025? โ An In-Depth Analysis
## Table of Contents:
- [๐ Summary](#-summary)
- [๐ Main Content](#-main-content)
- [๐ข 1. Array.prototype.groupByToMap](#1-arrayprototypegroupbytomap)
- [๐ 2. Set Methods and .toSorted for Sets](#2-set-methods-and-tosorted-for-sets)
- [๐ 3. Object.groupBy and Object.groupByToMap](#3-objectgroupby-and-objectgroupbytomap)
- [๐ 4. Reflect.getMetadata / setMetadata](#4-reflectgetmetadata--setmetadata)
- [โฉ 5. await.ops Syntax](#5-awaitops-syntax)
- [๐ 6. Minor/Editorial Changes](#6-minoreditorial-changes)
- [๐๏ธ Notes](#-notes)
- [๐ References](#-references)
- [๐ฃ๏ธ Paraphrase](#-paraphrase)
- [๐ฐ Newsletter](#-newsletter)
- [โ
Action Items](#-action-items)
- [๐งช Hypotheses](#-hypotheses)
- [๐ Methodology](#-methodology)
- [โ Questions](#-questions)
- [๐ฎ Future Research](#-future-research)
- [๐ก Implications](#-implications)
- [๐ง Learning Styles Assessment](#-learning-styles-assessment)
- [๐ Accessibility Assessment](#-accessibility-assessment)
- [๐ DEIB (Diversity, Equity, Inclusion, and Belonging) Assessment](#-deib-diversity-equity-inclusion-and-belonging-assessment)
- [โ
Logical Validity](#-logical-validity)
- [๐ DARVO Analysis](#-darvo-analysis)
- [๐ SEO Evaluation](#-seo-evaluation)
- [๐ฏ Conclusion](#-conclusion)
---
## ๐ Summary:
The article "Whatโs new in ECMAScript 2025?" by Pawel Grzybek provides an overview of upcoming changes and proposed features for ECMAScript 2025 (ES2025), the JavaScript language standard. The author breaks down each new feature, offering concise explanations, code examples, and use cases for developers and web professionals. The tone is friendly, clear, and geared toward practical implementation.
---
## ๐ Main Content:
### ๐ข [1. Array.prototype.groupByToMap](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/#arrayprototypegroupbytomap)
- Introduces a new array method that groups elements into a `Map` based on a callback function.
- Returns a `Map`, preserving insertion order and supporting any value as a key (unlike groupBy which returns a plain object).
### ๐ [2. Set Methods and .toSorted for Sets](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/#set-methods-and-tosorted-for-sets)
- Adds new methods to the `Set` object, bringing it closer to `Array` capabilities.
- Examples: `.map`, `.filter`, `.some`, `.every`, `.find`, `.toSorted`, etc.
- `.toSorted` returns a new Set with elements sorted, keeping the original Set unchanged.
### ๐ [3. Object.groupBy and Object.groupByToMap](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/#objectgroupby-and-objectgroupbytomap)
- `Object.groupBy`: Groups object values based on a callback, returning an object where keys are group identifiers.
- `Object.groupByToMap`: Like above, but returns a `Map` instead of an object.
- Useful for grouping arbitrary collections of objects/values in a functional style.
### ๐ [4. Reflect.getMetadata / setMetadata](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/#reflectgetmetadata--setmetadata)
- New Reflect methods to attach and retrieve metadata to JavaScript objects or their properties.
- Useful for frameworks, libraries, and decorators, enabling richer runtime information and introspection.
### โฉ [5. await.ops Syntax](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/#awaitops-syntax)
- Experimental new syntax for handling multiple `await` operations in parallel.
- Aims to simplify and clarify code that currently uses `Promise.all` and similar patterns.
- Still at proposal stage but promising for future async code readability.
### ๐ [6. Minor/Editorial Changes](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/#minoreditorial-changes)
- Minor updates, clarifications, and editorial improvements to the ECMAScript standard.
- No breaking changes; mainly documentation and standards language refinements.
---
### ๐๏ธ Notes
- **groupByToMap**: Provides a more flexible way to group array elements, solving the limitations of groupBy (non-object keys).
- Useful for data manipulation, analytics, UI logic.
- **Set Methods**: Major quality-of-life improvement, enabling functional patterns with sets.
- Now possible to map/filter sets without converting to arrays.
- **Object.groupBy / groupByToMap**: Great for aggregating records by property or computed value.
- Returns Map for guaranteed key ordering and flexibility.
- **Reflect Metadata**: Facilitates the decorator pattern and rich library/framework support.
- Can improve debugging, logging, and meta-programming.
- **await.ops**: May eventually lead to more concise concurrent/async logic.
- At early stage; syntax and adoption subject to change.
- **Editorial**: Ongoing commitment to clarifying and improving the standard, supporting developer adoption and ecosystem growth.
---
## ๐ References:
- Pawel Grzybek, ["Whatโs new in ECMAScript 2025?"](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/)
- [ECMAScript Proposal Status](https://github.com/tc39/proposals)
---
## ๐ฃ๏ธ Paraphrase:
1. **Original:**
> โArray.prototype.groupByToMap is a new array method that works similarly to groupBy, but returns a Map instead of an object. This gives developers the ability to use non-string keys and guarantees key order, which is important in many data manipulation scenarios.โ
**Paraphrase:**
Arrayโs new `groupByToMap` method is just like `groupBy` but yields a `Map`, letting developers use any type of key and ensuring the groups maintain their original orderโa big advantage in advanced data handling.
2. **Original:**
> โNew methods for Set objects such as .map, .filter, and .toSorted bring Sets closer to Arrays in terms of usability. Now developers can perform functional operations directly on Sets without converting them first.โ
**Paraphrase:**
With additions like `.map`, `.filter`, and `.toSorted`, Sets now offer the same functional operations as Arrays, making it easy to manipulate sets without needing to transform them into arrays first.
---
## ๐ฐ Newsletter:
**๐ฐ This Month in JavaScript: ECMAScript 2025 Arrives!**
Heads up, devs! ES2025 is packed with shiny new features. `Array.prototype.groupByToMap` lets you group arrays straight into Maps, and Set objects are leveling up with array-like methods (`.map`, `.filter`, `.toSorted`, and more). Object grouping is easier than ever, Reflect gets real metadata power-ups, and there's even a glimpse of more readable parallel async with `await.ops`.
Want to write cleaner, faster, and more maintainable JS? [Read the full breakdown](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/). Stay tuned for tutorials and plugin updates to help you put these changes to work!
---
## โ
Action Items:
- **Advocacy & Training:** Incorporate ES2025 features into WordPress/JavaScript curriculum for onboarding new contributors and teams.
- **Contributor Guides:** Update internal docs and training to highlight new groupByToMap and Set methods, improving code quality and modern best practices.
- **Open Source Engagement:** Collaborate with plugin/theme developers to pilot new features, demonstrating the advantages of modern JS in WordPress.
- **Governance & Inclusion:** Use new features in community workshops, making ES2025 approachable for all skill levels.
- **Transparency:** Document migration strategies for adopting new features, sharing lessons learned for community benefit.
- **OSPO Readiness:** Position yourself as a forward-thinking OSPO leader by adopting and evangelizing emerging standards.
---
## ๐งช Hypotheses:
- Adoption of ES2025โs Set and groupBy enhancements will increase code readability and reduce bugs in complex WordPress plugins.
- The new metadata APIs will accelerate the development of decorator-based libraries in the WP ecosystem.
- Early exposure to
- Summary: A short summary of every new feature added to the ECMAScript specification this year, with easy-to-follow, illustrative examples. A bunch of great new features.
- URL: https://pawelgrzybek.com/whats-new-in-ecmascript-2025/
[Another version of ECMAScript version has been approved by the TC39](https://ecma-international.org/news/ecma-international-approves-new-standards-11/), and to keep my annual tradition Iโm sharing whatโs new in the [ES2025](https://262.ecma-international.org/16.0/index.html) with simple practical examples. If you want to catch up with the previous editions, here you have them: [2024](https://pawelgrzybek.com/whats-new-in-ecmascript-2024/), [2023](https://pawelgrzybek.com/whats-new-in-ecmascript-2023/), [2022](https://pawelgrzybek.com/whats-new-in-ecmascript-2022/), [2021](https://pawelgrzybek.com/whats-new-in-ecmascript-2021/), [2020](https://pawelgrzybek.com/whats-new-in-ecmascript-2020/), [2019](https://pawelgrzybek.com/whats-new-in-ecmascript-2019/), [2018](https://pawelgrzybek.com/whats-new-in-ecmascript-2018/), [2017](https://pawelgrzybek.com/whats-new-in-ecmascript-2017/) and [2016](https://pawelgrzybek.com/whats-new-in-ecmascript-2016-es7/). Now, letโs see what is new this year.
Regex capture groups are super helpful, but before ES2025 it was disallowed to duplicate them across alternatives (chunks separated by `|`). Prior to this release, it resulted in a syntax error, but this years update makes it work.
```
const pattern = /ECMAScript(?<version>[0-9]{4})|ES(?<version>[0-9]{2})/;
// ๐ ๐
// <ES2025
"ECMAScript2025".match(pattern);
// SyntaxError: Invalid regular expression: /ECMAScript(?<version>[0-9]{4})|ES(?<version>[0-9]{2})/: Duplicate capture group name
// >=ES2025
"ECMAScript2025".match(pattern);
// "2025"
```
This proposal makes `Sets` more powerful. It adds the following methods to the Set prototype: `intersection`, `union`, `difference`, `symmetricDifference`, `isSubsetOf`, `isSupersetOf`, and `isDisjointFrom`.
```
const setOne = new Set([1, 2, 3]);
const setTwo = new Set([3, 4, 5]);
setOne.intersection(setTwo);
// Set(1) { 3 }
setOne.union(setTwo);
// Set(5) { 1, 2, 3, 4, 5 }
setOne.difference(setTwo);
// Set(2) { 1, 2 }
setOne.symmetricDifference(setTwo);
// Set(4) { 1, 2, 4, 5 }
setOne.isSubsetOf(setTwo);
// false
setOne.isSupersetOf(setTwo);
// false
setOne.isDisjointFrom(setTwo);
// false
```
[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) makes a great job of explaining every single one of these methods, but to be fully proficient with Sets, I would highly recommend catching up on some basics of [the Set theory](https://en.wikipedia.org/wiki/Set_theory).
This one allows developers to add regular expression flags (`i` for case insensitivity, `m` for multi-line and so on) to a subset of patterns in contrast to the whole expression. Look at this example that targets the word โbearerโ and ignores capitalisation, followed by the literal โabcโ that needs to be lowercase. Subexpression modifiers are present in Regex engines built into other programming languages like Pearl or .NET, and this year are also available in ECMAScript. This is super useful!
```
const pattern = /^(?i:bearer) abc$/;
pattern.test("bearer abc");
// true
pattern.test("Bearer abc");
// true
pattern.test("bEaReR abc");
// true
pattern.test("bearer ABC");
// false
```
We have been importing non-JS files for ages. Thanks to the powerful bundlers, importing a CSS, SVG file, or JSON data heap has become the norm. The new import `type` attribute informs the module system about the MIME type, configures fetching behaviour, and orchestrates parsing and evaluation of the imported asset. This ensures that the correct validation rules are applied and prevents potential security risks. Implementing this feature was a baseis for JSON modules, and as of now this is the only non-JS format supported, but additional types will come in the following years.
```
// Import
import data from "./data.json" with { type: "json" };
// Dynamic import
const data = await import("./data.json", { with: { type: "json" } });
// Re-export
export { data } from "./data.json" with { type: "json" };
```
I love working with iterators in Rust. This proposal brings us closer to this realm and makes working with them in JavaScript a lot more enjoyable. No more `Array.from()` or some third party libs. This is by far my favourite proposal that landed in the new specification. Here is a list of new methods!
* `map()`
* `filter()`
* `take()`
* `drop()`
* `flatMap()`
* `reduce()`
* `toArray()`
* `forEach()`
* `some()`
* `every()`
* `find()`
* `Iterator.from()` (static method)
Some of them (`map`, `filter`, `reduce`, `flatMap`, `some`, `find` and `every`) mimic the naming and functionality of methods from the `Array.prototype`, and their usecase and functionality should be familiar. Here is a quick example.
```
const iter = [..."ECMAScript2025"].values();
const iterNumeric = iter.filter((c) => /^\d$/.test(c));
iterNumeric.next();
// { value: '2', done: false }
iterNumeric.next();
// { value: '0', done: false }
iterNumeric.next();
// { value: '2', done: false }
iterNumeric.next();
// { value: '5', done: false }
iterNumeric.next();
// { value: undefined, done: true }
```
Some of them (`drop`, `take`) are just for iterator manipulations and are not present in an `Array.prototype`.
```
const iter = [..."ECMAScript2025"].values();
const iterNumeric = iter.drop(10).take(4);
iterNumeric.next();
// { value: '2', done: false }
iterNumeric.next();
// { value: '0', done: false }
iterNumeric.next();
// { value: '2', done: false }
iterNumeric.next();
// { value: '5', done: false }
iterNumeric.next();
// { value: undefined, done: true }
```
Wrapping a non-sync function in a Promise is a common operation. The new `Promise.try` is an elegant wrapper for sync or async operations that ensures a returned promise. Here is a simple use case.
```
const handleAction = (action) =>
action
.then((result) => console.log(result))
.catch((error) => console.error(error))
.finally(() => console.log("done"));
handleAction(new Promise((resolve, reject) => resolve("all good")));
// all good
// done
```
```
const handleAction = (action) =>
action
.then((result) => console.log(result))
.catch((error) => console.error(error))
.finally(() => console.log("done"));
handleAction(new Promise((resolve, reject) => reject("uuuupps")));
// uuuupps
// done
```
The `handleAction` works great with these two, because in both cases the passed argument is a Promise. What will happen if the argument is a sync operation though?
```
const handleAction = (action) =>
action
.then((result) => console.log(result))
.catch((error) => console.error(error))
.finally(() => console.log("done"));
handleAction(() => "look ma, no promise!");
// TypeError: action.then is not a function
```
This is a common situation when people reach for `npm i p-try`, but now thatโs not needed as this helper is built into the language. Here is an example with a sync action again, and another one when it throws.
```
const handleAction = (action) =>
Promise.try(action) // ๐๐๐
.then((result) => console.log(result))
.catch((error) => console.error(error))
.finally(() => console.log("done"));
handleAction(() => "look ma, no promise!");
// look ma, no promise!
// done
```
```
const handleAction = (action) =>
Promise.try(action) // ๐๐๐
.then((result) => console.log(result))
.catch((error) => console.error(error))
.finally(() => console.log("done"));
handleAction(() => {
throw "look me, no promise, but an error!";
});
// look me, no promise, but an error!
// done
```
To complement the already existing `Float32Array` and `Float64Array` in the language, this proposal adds the missing [half-precision floating-point format](https://en.wikipedia.org/wiki/Half-precision_floating-point_format), `Float16Array`. This proposal hardly makes any difference for web developers, but for graphics-intensive calculations where memory is limited, this can save the day.
Mechanism for escaping literal strings is something that the community has been asking for a very long time. It is present in Perl, PHP, Python, Ruby and many others. Letโs look at the problem and the solution that the new `RegExp.escape()` solves.
```
const sentence = "He has two dogs. I have one dog.";
const pattern = /dog./;
const newSentence = sentence.replace(pattern, "cat.");
console.log(newSentence);
// He has two cat.. I have one dog.
```
Uuups. The `.` token in the pattern is matching any single character, but our intention was to match a literal `.`. Here is where the new `RegExp.escape()` comes in handy.
```
const sentence = "He has two dogs. I have one dog.";
const pattern = new RegExp(RegExp.escape("dog.")); // ๐๐๐
const newSentence = sentence.replace(pattern, "cat.");
console.log(newSentence);
// He has two dogs. I have one cat.
```
This example is not the best, but imagine if the value inside the regex is coming from an external source or user input. This solves a huge problem and simplifies otherwise complex and error-prone solutions.
#### JavaScript Trademark[#](https://pawelgrzybek.com/whats-new-in-ecmascript-2025/#javascript-trademark)
Did you know that โJavaScriptโ is a registered trademark and belongs to Oracle? This company has very little to do with this language, but this is the main reason why we refer to this language as ECMAScript, and the reason why organising a โJavaScript Confโ violates trademark rules. Pretty silly, right?
Folks from Deno filed and open petition to release the โJavaScriptโ trademark. Thousands of developers signed a letter to help to make JavaScript free. If you havenโt already, please do so at [javascript.tm](https://javascript.tm/). Thank you ๐, What's New in ECMAScript 2025, Pawel Grzybek - https://pawelgrzybek.com/, 01jz36d1y0xc30cqebjdwvwg63.