Skip to content

The Future of JavaScript: ECMAScript 2023 Highlights

06/06/20232 min read

What's new in ECMAScript 2023

Open
the little black creature flips a row of tiles numbered 1-5 upside down so they read 5-1, then searches from the left with a magnifying glass, illustrating the findLast() array method in ECMAScript 2023

ECMAScript 2023 is the next version of the ECMAScript language and it is expected to be released at the end of June 2023. Here are some of the new features that have reached stage 4 and are expected to be included in ECMAScript 2023 :

Array find from last proposal

This proposal adds the findLastIndex() prototype method which does the same thing as the findIndex() method but in reverse order.

Here’s an example code snippet for using the findLastIndex() method. Press Run to execute it right here, or Edit to poke at it first:

const arr = [1, 2, 3, 4, 5];
const index = arr.findLastIndex((element) => element > 2);
console.log(index); // Output: 4

Hashbang Grammar

Hashbang is a character sequence preceding an executable script. ECMAScript 2023 adds support for #! comments at the beginning of files to help make ECMAScript files directly executable.

Symbols as WeakMap keys

Symbols as WeakMap keys fills in a small gap in the language. Symbols are unique and can not be recreated in JavaScript. This proposal extends the WeakMap API to allow unique symbols.

Change array by copy

This proposal adds a new method called toSpliced() on Array.prototype which allows you to change an array by copy.

Here’s the old way next to the new one. Flip between the tabs and watch what happens to the original array:

const arr = [1, 2, 3, 4, 5];
arr.splice(2, 2, 6, 7);
console.log(arr); // Output: [1, 2, 6, 7, 5] (original mutated)
const arr = [1, 2, 3, 4, 5];
const newArr = arr.toSpliced(2, 2, 6, 7);
console.log(newArr); // Output: [1, 2, 6, 7, 5] (original intact)

Did this resonate?