Intermediate Algorithm Scripting - Seek and Destroy

Tell us what’s happening:
Describe your issue in detail here.
Can someone tell me why my code does not work. Thank you

   **Your code so far**
function destroyer(arr) {
 
 let objToArr = Array.from(arguments);
let optionalArgs =  objToArr.slice(1,3);
return arr.filter(function(num) {
 return optionalArgs.indexOf(num) === -1;
});

}

console.log(destroyer([3, 5, 1, 2, 2], 2, 3, 5));
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Intermediate Algorithm Scripting - Seek and Destroy

Link to the challenge:

are you sure you are getting them all? using the arguments object should allow you to access any number of arguments, you are getting always only two numbers tho
image

1 Like

wow, I have understand that. Thank you.