Array.reverse

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"

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.