Javascript - Array reverse() Method

The reverse() method reverses the order of the elements in an array.

Description

The reverse() method reverses the order of the elements in an array.

Syntax

array.reverse()

Parameters

None

Return

An Array, representing the array after it has been reversed

Example

Reverse the order of the elements in an array:

Demo

var myArray = ["XML", "Json", "Database", "Mango"];
console.log( myArray );//from  ww  w  .  ja v a  2 s  . c o  m

myArray.reverse();
console.log( myArray);

Result