reverse Method

Microsoft Office JScript

Microsoft® JScript® reverse Method  Language Reference 
Version 2 

See Also                  Applies To


Description
Returns an Array object with the elements reversed.
Syntax
arrayobj.reverse( )
Remarks
The reverse method reverses the elements of an Array object in place. It does not create a new Array object during execution.

If the array is not contiguous, the reverse method creates elements in the array that fill the gaps in the array. Each of these created elements has the value undefined.

The following example illustrates the use of the reverse method:

function ReverseDemo()
{
  var a, l;
  a = new Array(0,1,2,3,4);
  l = a.reverse();
  return(l);
}