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.
My code is
let newArr = [];
for(let item of arr){
for(let i =0;i<item.length;i++){
newArr.push(item[i]);
};
};
console.log(newArr);
let x = [0];
for(let item of newArr){
if(x.indexOf(item) === -1){
x.push(item)
};
};
x.shift()
return x;
uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]);\
return [1,2,3,5,4,6,7,8]
My function return is correct. So, why freecodecamp show wrong. Please some one tell me is there any issue in my code