I have sliced the additional arguments and stored them in the values variable then looped over it and checked if the arr includes any value of the values array in a condition and then entered the condition and splice the value from arr
it did not work and I consoled the values were 1 and 3 and there is no 1 in the additional arguments why this is happening I have tried the same way with includes array method
function destroyer(arr) {
let values = Array.from(arguments).slice(1);
for (let i = 0; i < values.length; i++) {
if (arr.indexOf(values[i])) {
console.log(arr.splice(i, 1))
}
}
console.log(arr)
return arr
}
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/99.0.4844.82 Safari/537.36
Challenge: Seek and Destroy
Link to the challenge: