let ar1 = [1,2,3,4,5] let ar2 = [6,7,8,9,10] let merge = [...ar1,...ar2] console.log(merge) // [1,2,3,4,5,6,7,8,9,10]
function mergeArrays(arr1, arr2) { return Array.from(new Set(arr1.concat(arr2).sort((a,b) => (a-b)))); }