Tell us what’s happening:
i need help to this code exercise
Your code so far
function copyMachine(arr, num) {
let newArr = [];
while (num >= 1) {
// Only change code below this line
newArr = newArr[...arr];
// Only change code above this line
num--;
}
return newArr;
}
console.log(copyMachine([true, false, true], 2));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36
.
Challenge: Copy an Array with the Spread Operator
Link to the challenge: