Go back

ECMAScript 2026 is officially approved: what is new in the JavaScript standard? ๐Ÿš€

ES2026 adds precise summation, Map upsert, Base64 and hex, Error.isError, JSON.parse improvements and Iterator.concat.

ECMAScript 2026 is officially approved: what is new in the JavaScript standard? ๐Ÿš€

TC39 has approved the 17th edition of the ES2026 specification. There is no revolution or language rewrite, but some extremely useful utilities have arrived to address old pain points and free us from small workaround libraries.

Here are the main additions you can already use natively:

๐Ÿ”น Math.sumPrecise(): precise addition of fractional numbers The perennial 0.1 + 0.2 === 0.30000000000000004 problem has finally been addressed at the standards level. The method takes an iterable of numbers and adds them without progressive loss of precision, which is crucial for financial calculations. ๐Ÿ”น Map.prototype.getOrInsert() and getOrInsertComputed() Native upsert. No more writing checks like if (!map.has(key)) map.set(...). getOrInsert(key, defaultValue) immediately returns the value or inserts the default, while getOrInsertComputed(key, callback) only calls the callback to calculate the default when the key really is missing. ๐Ÿ”น Native Base64 and hex support in Uint8Array Goodbye to workarounds with atob() and btoa(), which worked with strings rather than bytes. Now binary data can be encoded out of the box: bytes.toBase64() and Uint8Array.fromBase64(string). The same has been added for hex. ๐Ÿ”น Error.isError(): reliable error detection The err instanceof Error check often broke when code ran in different contexts. The new method solves this problem globally at the engine level. ๐Ÿ”น JSON.parse with access to the source text. The reviver in JSON.parse(text, reviver) now receives a third argument, a context object containing context.source: the original string representation of a particular property before parsing. Perfect for catching overly long numbers and converting them to BigInt before JS rounds them into a Number. ๐Ÿ”น Iterator.concat() Lets you efficiently combine multiple iterators into one without creating intermediate arrays or allocating extra memory.

The specification is already approved, and most features have already rolled out to modern browsers and runtimes.

Read more

Which feature do you like most? Personally, I was waiting for native Map upsert about three years ago.

Copied