Pangram verdict · v3.3
We believe that this text is a mix of AI and human-written content.
AI likelihood · overall
MixedArticle text · 910 words · 6 segments analyzed
We’ve done posts like this for CSS, but JavaScript deserves the same dangnabit! Especially as JavaScript does a better job of versioning itself anyway. We’ll cover new stuff in the language itself, but being a JavaScript practitioner involves more than the language itself, extending into runtimes, frameworks, libraries, and tooling. Let’s just do this, you’ve probably scrolled down already anyway. What’s New in the Language JavaScript has yearly version releases, which is a pretty nice way of doing things if you ask me! ECMAScript 2025 The latest is ECMAScript 2025, which came out in June 2025, and the whole spec of that version is available. Iterator Helpers There are now methods like .map(), .filter(), .take(), .drop() directly on iterators with lazy evaluation. Honestly, to a mostly front-end guy like me, this feels a bit esoteric. Like, we already can map over arrays, so what’s the big deal? But I do understand performance, and that’s one aspect here. const result = array .map(x => x * 2) // creates a new array in memory .filter(x => x > 10) // ... and again .slice(0, 3); // ... and againCode language: JavaScript (javascript) So that’s “slow” and “memory intensive”, especially if the array is quite large and the things you’re doing are “expensive” as they say. The fancy new way is like this: const result = Iterator.from(array) .map(x => x * 2) .filter(x => x > 10) .take(3) .toArray(); // No new arrays created, computation stops after 3Code language: JavaScript (javascript) And as a nice bonus, that whole Iterator.from() thing works on anything iterable. So not just arrays, but sets, maps, generators, etc, which means they all get the same nice set of functions to use. Set Methods Sets are kinda nice in JavaScript as it’s like an array only each item is guaranteed to be unique. That’s nothing new, but if you have two sets, now we have methods for returning interesting things about them, like what overlaps, what doesn’t, etc.
const youKnow = new Set(["JS", "Python", "CSS", "SQL"]); const jobNeeds = new Set(["JS", "TypeScript", "Python"]); // Skills the job wants that you already have youKnow.intersection(jobNeeds); // → Set {"JS", "Python"} // Everything combined — your full stack + job needs youKnow.union(jobNeeds); // → Set {"JS", "Python", "CSS", "SQL", "TypeScript"} // What the job needs that you DON'T know yet (skill gaps) jobNeeds.difference(youKnow); // → Set {"TypeScript"} // Skills you have that the job doesn't care about youKnow.difference(jobNeeds); // → Set {"CSS", "SQL"} // Skills that appear in only one set, not both youKnow.symmetricDifference(jobNeeds); // → Set {"CSS", "SQL", "TypeScript"} // Are all job requirements a subset of what you know?
jobNeeds.isSubsetOf(youKnow); // → false // Do you have every skill and more? youKnow.isSupersetOf(jobNeeds); // → false // Do you and the job have zero overlap? youKnow.isDisjointFrom(jobNeeds); // → falseCode language: JavaScript (javascript) Pretty useful, I’d say. Claude Code had fun producing an interactive demo from that. RegEx Updates Lemme set the stage here. You’re building an on-page search function where your users type in their own search terms. And you want to implement this as a RegEx search. There is some danger there, as some characters a user may type in are “special” characters in RegExs, like how a $ matches the last character or whatever. So if the user searches for $9 and you just dunk that into a RegEx, it would break. Which characters you need to “escape” to fix that are specific to the implementation of RegEx at hand. So! After apparently a 15-year journey, there is now RegExp.escape(). const query = userInput; // e.g.
"$5.00 (off!)" // ❌ BEFORE — breaks for any regex special chars const badRe = new RegExp(query, "g"); // ✅ ES2025 — one method, problem solved const goodRe = new RegExp(RegExp.escape(query), "g");Code language: JavaScript (javascript) Again, Claude Code kinda knocked it out of the park with quite a good demo.
There has also been an update to how “flags” can work inside a RegEx. I feel like a super common one is that “i” flag, meaning case-insensitive. So you’d have a RegEx that ended in like /i meaning the whole thing is case-insensitive. But what if you only wanted part of a RegEx to be case-insensitive? Now you can wrap parts of it in parentheses and add those flags at the beginning. // Old way — you couldn't mix case sensitivity /[a-z]+@[A-Z]+/i // 'i' flag applies to EVERYTHING // ES2025 — inline modifiers per-group /(?i:[a-z.]+)@(?-i:[A-Z]+)\.(?i:com|org)/ //^^^^ case-insensitive part // ^^^^^ case-SENSITIVE part // ^^^ case-insensitive partCode language: JavaScript (javascript) Promise Update Everyone’s favorite asynchronous programming flow model (Promises) has a bit of an update with Promise.try() which can help simplify error handling.
A function might error in a sync or async way, and you’d have to handle them separately, but now you can deal with it together: // A function that MIGHT be async, MIGHT throw sync function loadUser(id) { if (!id) throw new Error("No ID"); // sync throw return fetch(`/api/users/${id}`); // async } // ❌ BEFORE — two separate error paths let p; try { p = loadUser(id); // catch sync throw here… } catch (e) { handleError(e); } p?.catch(e => handleError(e)); // …and async reject here // ✅ ES2025 — one liner, one .catch() Promise.try(() => loadUser(id)) .then(user => render(user)) .catch(err => showError(err)); // catches BOTHCode language: JavaScript (javascript) I will, once again, refer you to a Claude Code-produced demo which does a surprisingly good job of demonstrating the concept.