Reverse Array Order Method

The Reverse Array Order method reverses the order of the array elements so that the last element becomes the first element. It returns the elements in reverse order. It returns this reverse order in the arrayName argument. It reverses the existing array. It does not return a new array.

Format

arrayName.reverse()

The following example includes the Reverse Array Order method:

var communalInsect = new Array;
communalInsect[0] = "ant";
communalInsect[1] = "bee";
communalInsect[2] = "wasp";
communalInsect.reverse();

This example produces the following array:

communalInsect[0] == "wasp"
communalInsect[1] == "bee"
communalInsect[2] == "ant"