The Future of JavaScript: ECMAScript 2023 Highlights

06/06/2023

What's new 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:

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

Hashbang Grammar

Hashbang is a character sequence proceeding an executable script. ECMAScript 2023 adds support for #! comments at the beginning of files to better facilitate executable ECMAScript files.

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 an example code snippet for using the toSpliced() method:

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