Published Aug 6, 2023
Contribute to Docs

The .toReversed() reverses the elements within the array and returns a new copy of the array.


The .toReversed() method does not take any parameters.



Reverse the elements within the array without mutating the original array.

const points = [1, 2, 3, 4, 5];
const reversedPoints = points.toReversed();
console.log('Original', points);
console.log('Copy', reversedPoints);
Original [1,2,3,4,5]
Copy [5,4,3,2,1]

All contributors

Looking to contribute?

Learn JavaScript on Codecademy