JavaScript Array reverse() Method


The JavaScript array reverse() method changes the sequence of elements of the given array and returns the reverse sequence. In other words, the arrays last element becomes first and the first element becomes the last. This method also made the changes in the original array.

Javascript array reverse() method reverses the element of an array. The first array element becomes the last and the last becomes the first.

Syntax

array.reverse()

Example

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.reverse();

Example -