I was finally able to get my solution to pass. Originally I had a var answer = arr.filter(blah)
under the args variable and it would return every number in the argument. It only worked when i removed that variable and just returned the filter at the end. I am not sure why it worked that way and not the other.
Can anyone shed some light on to why that is, It would be appreciated.
link to challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy/
function destroyer(arr) {
var args = []; // variable for arguments. returns [2, 3]
//loop to extract the arguments
for (var i = 0; i < arguments.length; i++) {
if (i !== 0) {
args.push(arguments[i]);
}
}
//function to check if an array includes an item
function blah(item) {
if (args.includes(item) === false) {
return item;
}
}
return arr.filter(blah); // returns filtered results
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);```