JavaScript Array toReversed()
- Previous page splice()
- Next page toSorted()
- Go Back to the Previous Level JavaScript Array Reference Manual
Definition and usage
toReversed()
The method reverses the order of elements in the array.
toReversed()
The method returns a new array.
toReversed()
The method does not overwrite the original array.
toReversed()
The method is reverse()
A copy version of the method.
See also:
Example
// Create an array const fruits = ["Banana", "Orange", "Apple", "Mango"]; // Reverse the array const fruits2 = fruits.toReversed();
Syntax
array.toReversed()
Parameter
None.
Return value
Type | Description |
---|---|
Array | New array with reversed element order. |
Browser support
toReversed()
It is an ES2023 feature.
Starting from July 2023, all modern browsers support this method:
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome 110 | Edge 110 | Firefox 115 | Safari 16.4 | Opera 96 |
February 2023 | February 2023 | July 2023 | March 2023 | May 2023 |
- Previous page splice()
- Next page toSorted()
- Go Back to the Previous Level JavaScript Array Reference Manual