A-C > Array.push

Array.push

Syntax

myArray.push(value,...);

Arguments

value One or more values to append to the array.

Description

Method; adds one or more elements to the end of an array and returns the array's new length.

Player

Flash 5 or later.

Example

The following code creates the myPets array containing two elements, then adds two elements to it. After the code executes, pushed contains 4.

myPets = ["cat", "dog"];
pushed = myPets.push("bird", "fish");