JavaScript Array reverse()
Description
The reverse() method reverses the order of the elements in an array.
The reverse() method overwrites the original array.
Array Sort Methods:
| Method | Finds |
|---|---|
| reverse() | Reverses the order of the elements in an array |
| sort() | Sorts the elements of an array |
| toReversed() | Reverses the elements of an array into a new array |
| toSorted() | Sorts the elements of an array into a new array |
Syntax
array.reverse()
Parameters
| NONE |
Return Value
| Type | Description |
| Array | The array after it has been reversed. |
Array Tutorials:
Browser Support
reverse() is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera |