javascript array concat vs merge code example
Example 1: javascript concat two arrays
//ES6
const array3 = [...array1, ...array2];
Example 2: array merge in javascript
function mergeArrays(arr1, arr2) {
return Array.from(new Set(arr1.concat(arr2).sort((a,b) => (a-b))));
}