Table of Contents

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


Table of Contents