Logo

What's New in JavaScript (ECMAScript 2024 & Beyond)

A comprehensive guide to JavaScript's newest features in ECMAScript 2024, including Object.groupBy, Promise.withResolvers, and what's coming in ES2025

Salman Khan

5/17/2025 · 3 min read

JavaScript ECMAScript 2024 Features

🚀 What’s New in JavaScript (ECMAScript 2024 & Beyond)

JavaScript keeps evolving to make developers’ lives easier, code more expressive, and performance even better. ECMAScript 2024 (ES15), finalized in June 2024, brought several new features that simplify common patterns and make the language more powerful and modern.

In this post, we’ll explore these features with clear examples and outputs. I’ll also give you a sneak peek of what’s coming in ECMAScript 2025.

🔧 New Features in ECMAScript 2024 (ES15)

1. Object.groupBy() and Map.groupBy()

Grouping data is now built right into JavaScript using Object.groupBy and Map.groupBy. This lets you group iterable items based on a condition without third-party libraries.

const data = [
  { year: "2024", id: 0 },
  { year: "2023", id: 1 },
  { year: "2024", id: 2 },
];

const grouped = Object.groupBy(data, ({ year }) => year);
console.log(grouped);

Output:

{
  "2024": [
    { year: "2024", id: 0 },
    { year: "2024", id: 2 }
  ],
  "2023": [
    { year: "2023", id: 1 }
  ]
}

2. Promise.withResolvers()

Creating custom promises now feels more ergonomic. This method returns an object containing the promise and its associated resolve and reject functions.

const { promise, resolve, reject } = Promise.withResolvers();
resolve("Success");

promise.then(console.log);

Output:

Success

3. String.prototype.isWellFormed() and String.prototype.toWellFormed()

Working with Unicode can be tricky. These two methods help ensure your strings are well-formed, preventing issues with lone surrogate pairs.

const malformed = "\uD800"; // Lone surrogate character

console.log(malformed.isWellFormed()); // false
console.log(malformed.toWellFormed()); // "�"

Output:

false

4. RegExp /v Flag (Unicode Sets)

The new /v flag makes regex much more powerful when dealing with Unicode properties and sets.

const regex = /\p{Script=Latin}/v;

console.log(regex.test("abc")); // true
console.log(regex.test("Δ")); // false

Output:

true
false

5. Resizable and Transferable ArrayBuffer

Finally, ArrayBuffer and SharedArrayBuffer can be resized! No more creating new buffers and copying data manually.

let buffer = new ArrayBuffer(8, { maxByteLength: 16 });
console.log(buffer.byteLength); // 8

buffer.resize(12);
console.log(buffer.byteLength); // 12

Output:

8
12

6. Atomics.waitAsync()

This allows asynchronous waiting on atomic operations. It’s a game changer for non-blocking concurrency in multithreaded JavaScript apps using SharedArrayBuffer.

const sab = new SharedArrayBuffer(1024);
const int32 = new Int32Array(sab);

Atomics.waitAsync(int32, 0, 0).value.then(() => {
  console.log("Value changed");
});

Atomics.store(int32, 0, 1);

Output:

Value changed

🧪 Sneak Peek: What’s Coming in ECMAScript 2025 (ES16)

JavaScript’s future is also exciting with these features expected to land in ES2025:

1. Decorators (Stage 3)

Allows annotations and meta-programming at class and method levels.

2. Type Annotations (Stage 2)

Optional type annotations will help tools and editors give better suggestions and type checking.

3. ShadowRealm (Stage 3)

A secure way to evaluate code in a separate execution context—ideal for isolating untrusted code.

🎯 Final Thoughts

JavaScript is moving forward at a fast pace, making the language more expressive, developer-friendly, and powerful. These features are already available in most modern environments (like Node.js 20+ and modern browsers).

Start experimenting today!