What is wrong?
function uniteUnique(...arr) {
let newArr = [];
let ret = [];
let x;
for (let i = 1; i < arr.length; i++){
x = 0;
newArr = arr[i].filter((a) => {
if ((a !== 1) && (a !== 2) && (a !== 3)){
x++;
return a;
}
})
if (x > 0){
ret.push(newArr);
}
}
ret.unshift(arr[0]);
return ret;
}
uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
```
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.
Note: Backticks are not single quotes.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.

You need to review how filter works: you don’t return a value from it, you return true or false and it returns a new array keeping things that are true.
I can see what you’re trying to do though, and you’re literally checking if the value is not 1, 2 or 3. The point is to do a union of any collection of arrays, not just the one for that specific test. The tests are there as a baseline to make sure your code works, you can’t hardcode the answers to one specific test and expect to pass