DekGenius.com
Team LiB   Previous Section   Next Section
Array.push( ) append elements to an array

Availability

JavaScript 1.2; JScript 5.5; ECMAScript v3

Synopsis

array.push(value, ...)

Arguments

value, ...

One or more values to be appended to the end of array.

Returns

The new length of the array, after the specified values are appended to it.

Description

push( ) appends its arguments, in order, to the end of array. It modifies array directly, rather than creating a new array. push( ), and its companion method pop( ), use arrays to provide the functionality of a first in, last out stack. See Array.pop( ) for an example.

Bugs

In Netscape's implementations of JavaScript, when the language version is explicitly set to 1.2 this function returns the last value appended, rather than returning the new array length.

See Also

Array.pop( )

    Team LiB   Previous Section   Next Section