Archive for April 29, 2007

JavaScript push Method: Adding to an Array End

Posted in JavaScript, Software, Web, internet, programming on April 29, 2007 by Joey

The JavaScript push method can be used to add elements to an array. Any values provided to the push function are appended to the end of the array.

//Adds 5 at the end of the array
var aryTest = [1,2,3,4];
aryTest.push(5);
document.write(aryTest);

Related Articles:
JavaScript unshift Method – Adding to an Array Beginning