By Paul Krill
ECMAScript 2024, the latest version of ECMA International’s standard for JavaScript, has been officially approved, with features including transferring ArrayBuffers and advanced capabilities for working with string sets.
The ECMAScript 2024 specification, also generally known as ECMA-262, was approved on June 26. Among the features are added facilities for resizing and transferring ArrayBuffers and SharedArrayBuffers. ArrayBuffers have previously enabled in-memory handling of binary data. The new feature extends ArrayBuffer constructors to take an additional maximum length that allows in-place growth and shrinking of buffers. SharedArrayBuffer was also extended to take an additional maximum length that allows in-place growth.
Another capability featured in ECMAScript 2024 is the addition of a RegExp/v flag for creating RexExps with more advanced features for working with sets of strings. Also introduced was the Promise.withResolvers convenience method for constructing promises. Promise.withResolvers has been described as a mechanism for managing asynchronous operations. The feature adds a static method, known as withResolvers, to the Promise constructor, which returns a promise along with its resolution and rejection functions conveniently exposed. ECMAScript 2024’s Object.groupBy and Map.groupBy methods, meanwhile, are for aggregating data. And the Atomics.waitAsync method is for asynchronously waiting for a change to shared memory. The capability is primarily for use in agents that are not allowed to block. ECMAScript 2024 also adds the String.prototype.isWellFormed and String.prototype.toWellFormed methods for checking and ensuring that strings contain only well-formed Unicode.
In addition to being based on JavaScript, ECMAScript also is based on Microsoft’s JScript, described as a legacy dialect of the ECMAScript standard. Some features that did not make it into ECMAScript 2024 are still contenders for ECMAScript 2025 next year. These include duplicate named capturing groups, for regex capturing groups to be repeated, and new Set methods in JavaScript, to add methods like union and intersection to JavaScript’s built-in Set class. Last year’s ECMAScript 2023 specification offered methods for searching and changing arrays and extended the WeakMap API.