5 must-know methods for JavaScript ES 2023

Discover the 5 must-have methods in JavaScript ES 2023. Boost your skills with the latest ECMAScript features like findLast(), findLastIndex(), and much more.
•
Updated on August 14, 2026
•
4 min read
Believemy logo

JavaScript continues to improve and evolve over the years, and for good reason: each new version of the most popular programming language for web developers brings its share of innovations thanks to ECMAScript (ES).

Good to know

ECMAScript is the standard that defines JavaScript specifications. In other words, it's a kind of group that dictates the rules and functions available with JavaScript. Each version of ECMAScript brings new features that improve the language.

In the ECMAScript 2023 (ES14) version, several very useful methods for arrays (Array objects) have been introduced.

These new methods are primarily five:

  • array.findLast()
  • array.toSorted()
  • array.with()
  • array.toReversed()
  • array.toSpliced()

 

1. The array.findLast() method

The findLast() method works similarly to find() (which allows finding an element corresponding to our search), but with a key difference: it traverses the array in reverse, that is, from end to beginning.

It is therefore very useful for finding the last element that satisfies our condition.

Syntax

JAVASCRIPT
const result = array.findLast("element");

Example

JAVASCRIPT
const numbers = [1, 2, 3, 4, 5, 6, 7];
// Find the last even number in the array
const dernier = numbers.findLast(num => num % 2 === 0);
console.log(dernier); // 6

 

2. The array.toSorted() method

The toSorted() method creates a new sorted copy of the array without modifying the original.

Unlike sort(), which is destructive, toSorted() respects immutability, which is excellent news for developers who prefer functional approaches.

Good to know

In programming, a destructive operation directly modifies the value or structure of data, for example by changing an existing array with the sort() method.

Immutability, on the other hand, guarantees that data cannot be modified once created; any operation returns a new copy of the data without altering the original (as with the toSorted() method).

The functional approach relies on immutability, favoring functions that do not modify the global state (we call these pure functions 😉), making the code more predictable and easier to debug.

Syntax

JAVASCRIPT
const sortedArray = array.toSorted(unsortedArray);

Example

JAVASCRIPT
const unsortedArray = [3, 1, 4, 1, 5, 9];
const sortedArray = unsortedArray.toSorted((a, b) => a - b); // Sort from smallest to largest
console.log(sortedArray); // [1, 1, 3, 4, 5, 9]

 

3. The array.with() method

This method allows replacing a specific element inside an array, while creating a modified copy without changing the original array (we're talking about immutability, you know that now! 😬).

Syntax

JAVASCRIPT
const newArray = array.with(index, newValue);

Example

JAVASCRIPT
const fruits = ["apple", "banana", "cherry"];
const newFruits = fruits.with(1, "orange"); // Arrays start at 0
console.log(newFruits); // ["apple", "orange", "cherry"]

 

4. The array.toReversed() method

The toReversed() method returns a reversed version of an array without modifying the original.

Unlike the reverse() method, which directly modifies the array, toReversed() creates a copy to ensure that the original array remains unchanged: another immutable method. 😗

Syntax

JAVASCRIPT
const reversedArray = array.toReversed();

Example

JAVASCRIPT
const letters = ['a', 'b', 'c'];
const reversedLetters = letters.toReversed();
console.log(reversedLetters); // ['c', 'b', 'a']

 

5. The array.toSpliced() method

This method allows removing and/or inserting elements in an array, but like the other methods introduced with ES 2023, it creates a new copy of the array without modifying the original.

Syntax

JAVASCRIPT
const splicedArray = array.toSpliced(start, delete, ...newItems);

Example

JAVASCRIPT
const numbers = [1, 2, 3, 4, 5];
const newNumbers = numbers.toSpliced(2, 1, 6, 7);
console.log(newNumbers); // [1, 2, 6, 7, 4, 5]

A few important clarifications:

  • 2 - We insert new elements at index 2 (so at the third position)
  • 1 - We remove a single value (so the 3 from the array)
  • 6, 7 - We add elements 6 and 7

So we end up with an array where 3 is removed while integrating 6 and 7 before the original numbers 4 and 5.

 

Conclusion

These five new methods allow manipulating arrays while preserving their immutability (we discovered this together 😄), which is essential.

If you want to go even further, take a look at our entire course dedicated to JavaScript: it's a gem!

Our JavaScript dedicated training
Our JavaScript dedicated training
Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Why you should learn NextJS in 2025: all the benefits!

Explore why Next.js is a must-have framework for developers in 2025. Learn about its benefits, unique features and why the job market is increasingly adopting it.

December 6, 2024

Why you should learn React in 2025: all the benefits!

Explore why React remains a must-have choice in 2025 for developers. Discover its advantages, the evolution of its features and why the market continues to prefer it.

December 6, 2024

Respecting SOLID principles with React

The SOLID principles are a set of five fundamental programming concepts. They are mostly applied in OOP (Object-Oriented Programming). They can also be applied elsewhere. They are indispensable in software architecture. To present these principles, I've chosen to use Javascript rather than Typescript, so as not to weigh down the examples. We're going to apply these principles to a simple "Todo List".

December 11, 2024

Code faster with React using these techniques

Learn how to code faster with React thanks to simple but effective techniques used by experienced developers.

December 9, 2024

Creating a random colour generator with JavaScript

Want to practise your JavaScript skills? Try building a random colour generator! In this article, we'll look at how to do it.

December 9, 2024

What will be the most popular programming languages in 2025?

A new year begins, and with it its traditional ranking of the best programming languages of the moment: what will be the best programming language of the year? Let's find out together in this article!

December 9, 2024

The 10 best online React courses in 2026

Discover the 10 best online React courses in 2026. Full comparison: pricing, real-world projects, certification, and dedicated mentor support.

March 23, 2026

Syntax highlighting with HTML and CSS

If you have a blog or a portfolio on which you want to present code, whether HTML / JavaScript or CSS code extracts, you have undoubtedly come up against a problem: how do you activate syntax highlighting to make it look as if you had put the code in a code editor? In this article, we'll look at how to do it.

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.