merge array in jquery code example
Example 1: merge array in js
var array1 = ["Rahul", "Sachin"];
var array2 = ["Sehwag", "Kohli"];
var output = array1.concat(array2);
console.log(output);
var array1 = ["Dravid", "Tendulkar"];
var array2 = ["Virendra", "Virat"];
var output = [...array1, ...array2];
console.log(output);
Example 2: jquery array merge
jQuery.merge( first, second );
$.merge( [ 0, 1, 2 ], [ 2, 3, 4 ] );
let newArray = $.merge( [], [ 1, 2, 3, 4 ] );
Example 3: merge 2 arrays jquery
$.merge( [ 3, 2, 1 ], [ 4, 3, 2 ] )