Siebel eScript Language Reference > Siebel eScript Commands > Array Objects >

reverse() Method


The reverse() method switches the order of the elements of an array, so that the last element becomes the first.

Syntax

arrayName.reverse()

Parameter
Description
Not applicable
 

Returns

arrayName with the elements in reverse order.

Usage

The reverse() method sorts the existing array, rather than returning a new array. In any references to the array after the reverse() method is used, the new order is used.

Example

The following code:

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

produces the following array:

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


 Siebel eScript Language Reference 
 Published: 18 April 2003