Feedback on Seek and Destroy

Tell us what’s happening:
So I was really struggling trying to figure out how to use the arguments object, but once I realized I just needed to put the any arguments after the first into it’s own array I felt it was basically like the last problem. I would like some feedback though and also had questions about the solutions. So the third solution looked closest to what I did but it added a second argument to the function which I was under the impression the purpose of the challenge was to deal with a function that had more arguments than shown. Anyway just wanted to know if my solution was fine I guess, it would suck if it only solved the specific checks for the challenge and not the general problem if that makes sense. As always feedback is much appreciated.

Your code so far

function destroyer(arr) {
const secondArg = [];
for(let i = 1; i < arguments.length; i++){
  secondArg.push(arguments[i]);
}
  return arr.filter(element => !secondArg.includes(element));

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0

Challenge: Intermediate Algorithm Scripting - Seek and Destroy

Link to the challenge:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.