js concatenate array 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: es6 concat array
let fruits = ["apples", "bananas"];
let vegetables = ["corn", "carrots"];
let produce = [...fruits, ...vegetables];
Example 3: merge arrays in javascript
var array1 = ["Vijendra", "Singh"];
var array2 = ["Singh", "Shakya"];
console.log(array1.concat(array2));