Hello
I am getting the following alert ‘functions declared within loops referencing an outer scoped variable may lead to confusing semantics’ on line 7 . I think I get it that the args array is defined outside the for loop (hence outside function(x)'s scope. But how would I go about to reference args[i] in the for loop to make the comparison?
Your code so far
function destroyer(arr) {
// Remove all the values
var newArr = arguments[0];
var args = arr.prototype.slice.call(arguments, 1);
for (i=1;i<args.length; i++){
newArr = newArr.filter(function(x){
return x != args[i];
});
}
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0
.
Link to the challenge: