JavaScript has always been a flexible language, but recent updates have made it more powerful and expressive than ever. If you're still using workarounds for set operations, verbose promise control, or awkward chaining, it's time to update your toolbox.
In this post, we’ll explore some of the most useful new operators and built-in methods introduced in recent ECMAScript releases that every modern JavaScript developer should know.
1. Set.prototype.intersection()
and Set.prototype.difference()
Performing set operations in JavaScript used to be a pain. You had to loop manually or use libraries like Lodash. But not anymore.
const first = new Set([1, 2, 3]);
const second = new Set([2, 3, 4]);
const intersectionResult = first.intersection(second); // Set {2, 3}
const differenceResult = first.difference(second); // Set {1}
These are now native methods (in ES2024+), and they make your code more readable and concise.
2. Promise.withResolvers()
– Total Control Over Promises
Ever wanted to manually resolve or reject a promise outside of its constructor? This pattern was messy until now.
const { promise, resolve, reject } = Promise.withResolvers();
setTimeout(() => {
resolve('Done!');
}, 2000);
promise.then(console.log); // Output: Done!
It’s especially handy in testing, queue management, and advanced async flows. No more messy new Promise
hacks.
3. Logical Assignment Operators (&&=
, ||=
, ??=
)
A more elegant way to write conditional assignments.
let user = { isActive: false };
// Instead of:
if (!user.isActive) user.isActive = true;
// Use:
user.isActive ||= true;
Works similarly for &&=
(only assign if truthy) and ??=
(only assign if nullish).
These improve code brevity and are especially useful for assigning objects' properties.
4. Numeric Separators for Readability
Not a new operator per se, but a quality-of-life improvement you should definitely use.
const budget = 1_000_000;
const byteSize = 64_000_000;
console.log(budget); // 1000000
Your future self (and teammates) will thank you.
5. The Pipeline Operator (|>
) – Cleaner Functional Chaining
The pipeline operator |>
is a proposed (still in Stage 2) JavaScript syntax that allows for chaining function calls in a more readable way. It takes the result of an expression and passes it as an argument to the next function in the chain. This can help to avoid deeply nested function calls and make code easier to read and maintain.
const appendWorld = (str) => str + ' world';
const toUpperCase = (str) => str.toUpperCase();
const splitString = (str) => str.split(' ');
Before
const result = splitString(toUpperCase(appendWorld('hello')));
// Output: ["HELLO", "WORLD"]
After (|>
pipeline operator)
const result = 'hello'
|> appendWorld
|> toUpperCase
|> splitString;
// Output: ["HELLO", "WORLD"]
Much easier to read — especially when transformations get long. It’s inspired by Unix-style piping and functional programming.
NOTE: The pipeline operator is still a proposal and is not yet supported by all browsers. To use it, you may need to use a transpiler such as Babel.
JavaScript in 2025 is more expressive, readable, and developer-friendly than ever. Embracing these new operators isn't just about cleaner code — it's about writing code that's easier to debug, easier to teach, and easier to love.
Start using them in your projects or refactor parts of legacy code where it makes sense. And if you're preparing for interviews or working on open-source, these features can give you a solid edge.
Loved it? React, comment, and share!
What’s your favorite modern JavaScript feature that saved you time or simplified logic? Let’s discuss in the comments!
Top comments (2)
Very informative. Thank you so much, keep it up brother
Very helpful. Love the first one and others also.