JavaScript Array.prototype.reverse() Method
The reverse() method reverses the order of the elements of an array in place.
Description
The reverse() method reverses an array in place: the first element becomes the last and the last becomes the first. It returns a reference to the same array.
Because it changes the original, use toReversed() (or [...arr].reverse()) when you need to keep it.
Because it reverses in place and returns the same array, const reversed = arr.reverse() leaves arr and reversed pointing at the same, now reversed, array. Empty slots in sparse arrays stay empty but move to their mirrored positions. To reverse a string, convert it to an array of characters first, [...str].reverse().join('').
Syntax
array.reverse()Return Value
The same array, now reversed.
Example
Browser Support
The following information will show you the current browser support for the Array.prototype.reverse() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





