Name

Array.reverse( ) Method — reverse the order of elements in an array

Availability

Flash 5

Synopsis

array.reverse( )

Description

The reverse method reverses the order of elements in an array, swapping the last element with the first element, the second-to-last element with the second element, and so on.

Example

myList = new Array(3, 4, 5, 6, 7);
myList.reverse( );                             // myList is now [7, 6, 5, 4, 3]

See Also

Array.sort( )

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.