IMO the description of the challenge and the expected result don’t match. Here’s the current text:
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.
In other words, all values present from all arrays should be included in their original order, but with no duplicates in the final array.
The unique numbers should be sorted by their original order, but the final array should not be sorted in numerical order.
Check the assertion tests for examples.
This reads as though uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]) should return [3, 5, 4], i.e. “unique values,” “no duplicates.”
However, the expected output is [1, 3, 2, 5, 4].
Here’s my suggestion:
Write a function that takes two or more arrays and returns a new array consisting of the values from the first array followed by the values from the remaining arrays that are not found in the first array.
All values in the returned array should appear in the order in which they were provided. Do not sort in numerical order.
Example: uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]) should return [1, 3, 2, 5, 4].