pop (Array.pop method)

public pop() : Object

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

Availability: ActionScript 1.0; Flash Player 5

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)


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001360.html