A-C > Array.shift |  |

Array.shift

array.shift, shift

Availability

Flash Player 5.

Usage

    myArray.shift()

Parameters

None.

Returns

The first element in an array.

Description

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

Example

The following code creates the array `myPets` and then removes the first element from the array and assigns it to the variable `shifted`.

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

See also

`Array.pop`