intermediate

Modern JavaScript Features (ES2024 & ES2025) Worth Knowing in Interviews

The ES2024 and ES2025 features interviewers now expect — Object.groupBy, Promise.withResolvers, Set methods, iterator helpers, RegExp v flag, and more.


Why modern features are now interview material

Senior interviews increasingly end implementation questions with a twist: "Nice — does the language give you this for free now?" Knowing that Object.groupBy replaces a hand-rolled reduce, or that Promise.withResolvers replaces the deferred pattern, signals that you keep current. This page is the shortlist that actually comes up.

ES2024 highlights

Object.groupBy and Map.groupBy

Grouping — previously the most-written reduce in existence — is now built in:

const orders = [
  { id: 1, status: "paid" },
  { id: 2, status: "pending" },
  { id: 3, status: "paid" },
];
 
const byStatus = Object.groupBy(orders, (o) => o.status);
// { paid: [{id:1},{id:3}], pending: [{id:2}] }
 
const map = Map.groupBy(orders, (o) => o.status); // Map for arbitrary keys

Interview notes: the result of Object.groupBy has a null prototype (no inherited keys — see prototypal inheritance), and Map.groupBy is the right choice when group keys are objects.

Promise.withResolvers

Creates a promise plus its resolve/reject functions in one call — the standardized "deferred" pattern. It has its own deep dive in this catalog.

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

The RegExp v flag

A stricter, more powerful Unicode mode enabling set operations in character classes:

/[\p{Script=Latin}&&\p{Uppercase}]/v.test("A"); // intersection: uppercase Latin

You won't be asked to write these, but recognizing && (intersection) and -- (difference) inside [...] shows currency.

Well-formed Unicode strings

String.prototype.isWellFormed() and toWellFormed() detect/repair lone surrogates — relevant when an interviewer probes string edge cases (pairs nicely with custom trim follow-ups).

Atomics.waitAsync

Await a change to shared memory without blocking the thread — niche, but name-droppable when worker communication comes up.

ES2025 highlights

Iterator helpers

map, filter, take, drop, flatMap, reduce, toArray, forEach, some, every, and find directly on iterators — lazily evaluated. Big enough to get its own page.

function* naturals() { let n = 1; while (true) yield n++; }
 
const firstFiveEvenSquares = naturals()
  .filter((n) => n % 2 === 0)
  .map((n) => n * n)
  .take(5)
  .toArray(); // [4, 16, 36, 64, 100] — no infinite array materialized

Set methods

Real set algebra, finally:

const a = new Set([1, 2, 3]);
const b = new Set([2, 3, 4]);
 
a.intersection(b);          // Set {2, 3}
a.union(b);                 // Set {1, 2, 3, 4}
a.difference(b);            // Set {1}
a.symmetricDifference(b);   // Set {1, 4}
a.isSubsetOf(b);            // false
a.isDisjointFrom(new Set([9])); // true

If an interviewer asks you to dedupe-and-compare arrays, converting to Set and using these beats nested loops — and stating the O(n) vs O(n·m) difference earns the point.

RegExp.escape

Safely embed user input in a dynamic regex — the standard answer to a long-standing footgun:

const re = new RegExp(RegExp.escape(userInput), "i");

Import attributes and JSON modules

import config from "./config.json" with { type: "json" };

Worth knowing as the standardized form of a thing bundlers faked for years.

Float16 support

Math.f16round, Float16Array — mention-only, relevant to graphics/ML-adjacent roles.

How to use these in an interview

  1. Implement first, then name the built-in. "Here's my groupBy with reduce — in ES2024 I'd reach for Object.groupBy" is the strongest possible framing.
  2. Know the limits. structuredClone doesn't clone functions (details here); iterator helpers don't exist on plain arrays' values in old runtimes; Object.groupBy returns a null-prototype object.
  3. Don't gamble on availability. If asked "can you use X in production," the senior answer covers runtime support and transpilation/polyfill strategy in one sentence.

  • map, filter, take, and drop directly on iterators (ES2025): lazy evaluation without loading everything into an array.