Transposes the elements of an array: the first array element becomes the last and the last becomes the first.
Method of Array
Syntax
reverse()
Parameters
None
Description
The reverse method transposes the elements of the calling array object.
Examples
The following example creates an array myArray, containing three elements, then reverses the array.
This code changes myArray so that:
myArray[0] is "three"
myArray[1] is "two"
myArray[2] is "one"