Javascript examples for Array:push
Copy array by value
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w . j a v a2 s . co m var arr1 = ['a','b','c']; var arr2 = new Array(arr1); arr2.push('d'); //Now, arr1 = ['a','b','c','d'] document.write(arr1); document.write("<br />") document.write(arr2); } </script> </head> <body> </body> </html>