JavaScript Array toReversed()
Example
// Create an Array
const fruits = ["Banana", "Orange", "Apple", "Mango"];
// Reverse the Array
const fruits2 = fruits.toReversed();
Try it Yourself »
Description
The toReversed()
method reverses the order of the elements in an array.
The toReversed()
method returns a new array.
The toReversed()
method does not overwrites the original array.
The toReversed()
method is the copying version of the
reverse()
method.
See Also:
Syntax
array.toReversed()
Parameters
NONE |
Return Value
Type | Description |
Array | A new array with the items reversed. |
Array Tutorials:
Browser Support
toReversed()
is an ES2023 feature.
It is supported in all modern browsers since July 2023:
Chrome 110 | Edge 110 | Firefox 115 | Safari 16.4 | Opera 96 |
Feb 2023 | Feb 2023 | Jul 2023 | Mar 2023 | May 2023 |