So i’m doing the Sorted Union challenge, in which this is the starting code.
challenge --> https://www.freecodecamp.org/challenges/sorted-union
function uniteUnique(arr) {
return arr;
}
uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
The instructions read:
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.
So what the instructions mean is that i’m suppose to take all 3 arrays and get unique values and return them in order in their original array order.
My question is, how am i suppose to get all 3 arrays if i have one parameter? Its not a 2D array and i wont know how many arrays the input is, so i cant just put 3 parameters. When i run the code listed above i get:
[1, 3, 2]
(1/3 arrays)
Any ideas on how i get all 3 arrays with 1 parameter. I know you can change teh starting code, but the requirements dont use 2D arrays for there input…
What i mean by 2D arrays is all the input arrays in 1 big array so i can access all 3 at once. Am i missing something with this?