xxxxxxxxxx
// ES5 version use Array.concat:
let array1 = ["a", "b"]
let array2 = ["1", "2"]
let combinedArray = array1.concat(array2);
// combinedArray == ["a", "b", "1", "2"]
// ES6 version use destructuring:
let array1 = ["a", "b"]
let array2 = ["1", "2"]
let combinedArray = [array1, array2]
// combinedArray == ["a", "b", "1", "2"]
xxxxxxxxxx
const letters = ['a', 'b', 'c'];
const numbers = [1, 2, 3];
const newArray = letters.concat(numbers);
// newArrat is ['a', 'b', 'c', 1, 2, 3]
xxxxxxxxxx
var array1 = ["Vijendra", "Singh"];
var array2 = ["Singh", "Shakya"];
console.log(array1.concat(array2));
xxxxxxxxxx
const arrFirst = ['string1', 'string2'];
const arrSecond = ['string3','string4'];
const newArr = [arrFirst, arrSecond];
console.log(newArr);
xxxxxxxxxx
let arr1 = ['1', '2'];
let arr2 = ['3', '4'];
let combarr = [].concat(arr1); //define new variable, empty array then concatenating arr1 to it
combarr = combarr.concat(arr2); //combarr = itself, then concatenating arr2 to the end
console.log(combarr); //Expected output: ['1','2','3','4']
xxxxxxxxxx
const fruits = ['apple', 'orange', 'banana'];
const joinedFruits = fruits.join();
console.log(joinedFruits); // apple,orange,banana
xxxxxxxxxx
const letters = ['a', 'b', 'c'];
const numbers = [1, 2, 3];
letters.concat(numbers);
// result in ['a', 'b', 'c', 1, 2, 3]
xxxxxxxxxx
const myGirls = ["Cecilie", "Lone"];
const myBoys = ["Emil", "Tobias", "Linus"];
const myChildren = myGirls.concat(myBoys);