Array.shift( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
Array.shift( ) Method Flash 5

remove the first element of an array
array.shift()

Returns

The value of the first element of array, which is also deleted.

Description

The shift( ) method deletes the first element of an array and then moves all the remaining elements of the array up one position. The affected array's length is reduced by 1. Note that shift( ) differs from the pop( ) method, which deletes the last element of an array.

Example

myList = new Array ("a", "b", "c"); myList.shift();                         // myList becomes ["b", "c"]

See Also

Array.pop( ), Array.splice( ), Array.unshift( ); "Removing Elements from an Array," in Chapter 11

     



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

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