Array.push

push — Adds a new value to the end of the array.

Description

Array.push(mixed value)

Parameters

Name Description Type Default Optional
value mixed No

Return values

integer. The new length of the array.

Examples

Example #1 – push example
var array = [2, 4, 8, 16]; console.log(array); // [2, 4, 8, 16] console.log(array.length); // 4 console.log(array.push(32)); // 5 console.log(array); // [2, 4, 8, 16, 32] console.log(array.length); // 5

See also

External references