reverse ExampleΒΆ

The general syntax for this method is:

arrayName.reverse()

This method is straightforward - it reverses the order of the elements in the array.

No arguments are placed inside the parentheses ().

Example

1let arr = ['At', 'banana', 'orange', 'apple', 'zoo'];
2
3arr.reverse();
4console.log(arr);

Output

[ 'zoo', 'apple', 'orange', 'banana', 'At' ]