Combine two arrays and create a third array - Javascript jQuery

Javascript examples for jQuery:Array

Description

Combine two arrays and create a third array

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
  <script type="text/javascript">
    $(function(){//  www . j a  va2  s  .c o  m
var arr1=['A','B','C','D'];
var arr2=['a','b','c','d','2'];
var arr3 = [];
for(var i=0,len=arr1.length;i<len;i++){
    arr3[arr3.length] = arr1[i];
    arr3[arr3.length] = arr2[i];
}
console.log(arr3);
    });

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

Related Tutorials