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


JavaScript 1.2; JScript 5.5; ECMAScript v3


array.push(value, ...)


value, ...

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


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


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.


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