Flash Lite 2.x and 3.0 ActionScript Language Reference

pop (Array.pop method)

public pop() : Object

Removes the last element from an array and returns the value of that element.

Returns

Object - The value of the last element in the specified array.

Example

The following code creates the array myPets_array array containing four elements, and then removes its last element:

var myPets_array:Array = new Array("cat", "dog", "bird", "fish");
var popped:Object = myPets_array.pop();
trace(popped); // Displays fish.
trace(myPets_array); // Displays cat,dog,bird.

See also

push (Array.push method), shift (Array.shift method), unshift (Array.unshift method)