uniteUnique
by trentHarlem
HTML
<p>
Write a function that takes two or more arrays and returns a new array of unique values in the order of the original provided arrays.</p>
<p>
In other words, all values present from all arrays should be included in their original order, but with no duplicates in the final array.</p>
<p>
The unique numbers should be sorted by their original order, but the final array should not be sorted in numerical order.
</p>
JavaScript
function uniteUnique(arr) {
const newArr = Array.from(arguments).flat()
const output = Array.from(new Set(newArr))
return output
}
uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);