Why do i get some values as undefined?

Tell us what’s happening:
Hello. So for this challenge i create an array with all the values of all the arguments and then i create an empty one. Using a for loop i try to push in the empty array all the values that are not already in my empty array. As you can see, some values are ‘undefined’. Why is this happening, i dont understand.

Thanks, in Advanced!
Your code so far

function uniteUnique(arr,...args) {
let newArr = [...arr];
for(let i=0;i<args.length;i++){

let arr2 = [];

for(let i=0;i<newArr.length;i++){
return arr;

//uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
//uniteUnique([1, 2, 3], [5, 2, 1]);
uniteUnique([1, 2, 3,3,5,6], [5, 2, 1, 4], [2, 1], [6, 7, 8]);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36.

Challenge: Sorted Union

Link to the challenge:

Did you intend to use arr here instead of newArr?

Okay, please consider i was working all day and my mind is not in a good state.

This is embarrassing. :smiley: Thank you!

It happens to us all. Happy coding!