← Back to all briefs
JavaScript50s read

ES2026 Lands: getOrInsert, Math.sumPrecise, and toBase64 Ship in Every Browser

Seven new JavaScript features reach stage 4, including precise floating-point math, built-in Base64 for binary data, and cross-realm error detection. Temporal and Explicit Resource Management slip to ES2027.

ES2026 finalized this week with seven features reaching stage 4. The most immediately useful is Map.prototype.getOrInsert(), which collapses the common "check then set" pattern into one call: map.getOrInsert(key, () => computeDefault()). No more ternaries, no more if (!map.has(key)) boilerplate. Every codebase with a cache or lookup table just got shorter.

Math.sumPrecise() addresses a problem that has existed since JavaScript was created. Adding floating-point numbers loses precision due to binary representation, 0.1 + 0.2 !== 0.3 is the canonical example. Math.sumPrecise([0.1, 0.2]) uses a compensated summation algorithm that returns 0.3 exactly. For financial dashboards, analytics pipelines, and anything summing user-facing numbers, this eliminates a class of rounding bugs.

Uint8Array.prototype.toBase64() and Uint8Array.fromBase64() give the platform built-in binary-to-text encoding. You can drop the btoa/atob dance and their Unicode pitfalls. Error.isError() solves cross-realm type checking, an error from an iframe or a Worker will return true from Error.isError(err) even when err instanceof Error fails across realm boundaries. Iterator.concat() enables lazy concatenation of iterators, and Array.fromAsync() handles async iterables without manual for await loops.

Two features that were expected in ES2026 slipped to ES2027: the Temporal API for modern date handling, and Explicit Resource Management with the using keyword for automatic cleanup. Both are stage 4 and implemented in browsers behind flags but did not make the spec cutoff. Expect them in the 2027 edition.