Section 24.12. Array.reverse( ): reverse the elements of an array


24.12. Array.reverse( ): reverse the elements of an array

ECMAScript v1

24.12.1. Synopsis

array.reverse( )

24.12.2. Description

The reverse( ) method of an Array object reverses the order of the elements of an array. It does this in place: it rearranges the elements of the specified array without creating a new array. If there are multiple references to array, the new order of the array elements is visible through all references.

24.12.3. Example

 a = new Array(1, 2, 3);    // a[0] == 1, a[2] == 3; a.reverse( );               // Now a[0] == 3, a[2] == 1; 




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net