Sirted union help

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

What tests are you not passing?

You shouldn’t start with your array having a zero in it and then removing it - if there is a 0 somewhere it will not be present in the final array, you can just start with an empty array

it’s in java script chapter Intermediate Algorithm Scripting:sorted union challenge, when I click run the test. it show wrong

What tests are you not passing? Which ones have the Red Cross? What appear s in the console box once the tests have finished running?

Ohh…I just found my the issue. In function parameter I accidentally add just arr , I need to add …arr in order to code work. That’s why it show gray cross.

function uniteUnique(...arr){
    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;
}

This is my complete code