ECMAScript 2024 (ES15)
ECMAScript 2024 (ES15) — ES2024 brings `Promise.withResolvers()`, `Object.groupBy()`, `Map.groupBy()`, and `Array.prototype.toReversed()` among others. Object.groupBy(): Groups array elements by a key derived from a callback function. Example: Object.groupBy([1,2,3], n => n % 2 ? "odd" : "even"). Map.groupBy(): Similar to Object.groupBy but returns a Map. Example: Map.groupBy(users, u => u.role). Promise.withResolvers(): Returns a Promise with resolve and reject functions exposed. Example: const { promise, resolve, reject } = Promise.withResolvers(). Array.prototype.toReversed(): Returns a reversed copy without mutating the original. Example: [1,2,3].toReversed() // [3,2,1]. Array.prototype.toSorted(): Returns a sorted copy without mutating the original. Example: [3,1,2].toSorted() // [1,2,3]. Array.prototype.toSpliced(): Returns a copy with spliced elements. Example: arr.toSpliced(1, 1, 99). In total, ES2024 added 9 documented features to the language. Compare with the other editions on the ECMAScript versions page.