Hello, hope you can help me, I cannt understand why my solution is not working:
function destroyer(arr) {
const valsToRemove = [];
for(let i=1; i<arguments.length; i++) {
valsToRemove.push(arr[i]);
}
console.log(valsToRemove);
return arr.filter(function(val) {
return !valsToRemove.includes(val);
});
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
I used for loop in the beggining cause I read in the docs is better for optimization than slice with arguments.
Hope you can help, thank you very much in advance!