Array.pop( ) Method

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

remove the last element of an array
array.pop()

Returns

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

Description

The pop( ) method deletes the last element of an array, reduces the array's length by 1, and returns the value of the deleted element. Compare it with the shift( ) method, which deletes the first element of an array.

Example

myList = new Array("one", "two", "three"); trace ("Now deleting " + myList.pop());  // myList is now: ["one", "two"]

See Also

Array.push( ), Array.shift( ), Array.splice( ); Section 11.8; Section 5.12.3

     



    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