Hey guys, I think I’m stuck here and I really need some help.
I came up with the following Code:
(I’m pretty sure there is a much simpler way to solve this than mine, but I wanted to try it myself before looking into the wiki.)
`function destroyer(arr) {
return arr.filter(function(a){
var matched = 0;for (var i = 1; i < destroyer.arguments.length; i++){ if (a == destroyer.arguments[i]) { matched++; } } if (matched === 0) { return true; } return false;
});
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);`
In my opinion it works just fine.
The code removes all elements from the initial array that are of the same as the given arguments.
Here is the repl.it-Link: Sign up to continue coding - Replit
The FCC Console is always showing me : TypeError: Type Error
I hope someone knows an answer how I am able to pass the Challenge or how to get my Code to work.