Push object from one array to another - Javascript Array

Javascript examples for Array:push

Description

Push object from one array to another

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from   w  ww .j  ava2  s .c o m

var array1 = [{name:'john', address:'Main ave'}]
var array2 = [{name:'Mike', address:'First ave'}]
array1.push(...array2);
console.log(array1);


    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials