let array1 = [4,5,6]; let array2 = [7,8]; var array = array1.concat(array2); console.log(array); //Output : [4, 5, 6, 7, 8]
Arrays Concatenate in JavaScript using spread operator
let array1 = [4,5,6]; let array2 = [7,8,9]; var array = [...array1,...array2]; console.log(array); //Output : [4, 5, 6, 7, 8]