const merge = (arr1, arr2) => {
const mergedSet = new Set([...arr1, ...arr2]);
return Array.from(mergedSet);
};
const arr1 = [1, 2, 2, 3, 7, 7, 7, 8, 9];
const arr2 = [0, 0, 4, 4, 4, 5, 6, 7, 7, 8];
const mergedArray = merge(arr1, arr2);
mergedArray.sort();
console.log(mergedArray);
/*
run:
[
0, 1, 2, 3, 4,
5, 6, 7, 8, 9
]
*/