Tell us what’s happening:
Your code so far
function destroyer(arr, ...arg) {
let newArr = [];
for (let i = 0; i < arr.length; i++) {
if ((arg).indexOf(arr[i]) === -1) {
newArr.push(arr[i]);
console.log(newArr);
}
}
return newArr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
.
Challenge: Seek and Destroy
Link to the challenge: