10.07.2017 Views

javascript_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Javascript<br />

Its syntax is as follows:<br />

Array.push();<br />

Parameter Details<br />

element1, ..., elementN: The elements to add to the end of the array.<br />

Return Value<br />

Returns the length of the new array.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript Array push Method<br />

<br />

<br />

<br />

var numbers = new Array(1, 4, 9);<br />

var length = numbers.push(10);<br />

document.write("new numbers is : " + numbers );<br />

length = numbers.push(20);<br />

document.write("new numbers is : " + numbers );<br />

<br />

<br />

<br />

Output<br />

new numbers is : 1,4,9,10<br />

new numbers is : 1,4,9,10,20<br />

202

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!