Copy machine code not working

newArr.push([…arr]); didn’t work i’m confused

What is your full code?

herer is my code:

function copyMachine(arr, num) {
  let newArr;
  while (num >= 1) {
    // change code below this line
           newArr.push([...arr]);
    // change code above this line
    num--;
  }
  return newArr;
}

// change code here to test different cases:
console.log(copyMachine([true, false, true], 2));

That is because you declared newArr but never assigned it a value. Inside your while loop you start trying to call the push method on newArr, but newArr was never declared as an array.

thanks it works perfectly