javascript merge the contents of two arrays

demand:

var of arr1 = [ 1 , 2 , 3 ];
 var arr2 is = [ 4 , 5 , 6 ]; 

end result: 
[ 1 , 2 , 3 , 4 , 5 , 6 ]

Code:

= Array.prototype.addAll function (ARR) {
       the this .push.apply ( the this , ARR); 
    }; 

// The following code can be realized using the merged arr1.addAll (arr2);

 

Guess you like

Origin www.cnblogs.com/passedbylove/p/11579440.html