10.02.2018 Views

js_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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!