A-C > Array.shift

Array.shift

Syntax

myArray.shift();

Arguments

None.

Description

Method; removes the first element from an array and returns that element.

Player

Flash 5 or later.

Example

The following code creates the array myPets and then removes the first element from the array:

myPets = ["cat", "dog", "bird", "fish"];
shifted = myPets.shift();

The return value is cat.

See also

Array.pop
Array.unshift