1let arr1 = [0, 1, 2];
2let arr2 = [3, 5, 7];
3let primes = arr1.concat(arr2);
4
5// > [0, 1, 2, 3, 5, 7]
1//for ES5
2var array1 = ["Rahul", "Sachin"];
3var array2 = ["Sehwag", "Kohli"];
4
5var output = array1.concat(array2);
6console.log(output);
7
8//for ES6, we use spread operators to concat arrays
9
10var array1 = ["Dravid", "Tendulkar"];
11var array2 = ["Virendra", "Virat"];
12
13var output = [...array1, ...array2];
14console.log(output);
15
1const array1 = ['a', 'b', 'c'];
2const array2 = ['d', 'e', 'f'];
3const array3 = [...array1, ...array2];
4
5console.log(array3);
6// expected output: Array ["a", "b", "c", "d", "e", "f"]
1const array1 = ['a', 'b', 'c'];
2const array2 = ['d', 'e', 'f'];
3const array3 = array1.concat(array2);
4
5console.log(array3);
6// expected output: Array ["a", "b", "c", "d", "e", "f"]