Hi guys,
I’m trying to understand the intermediate solution to the problem.
function destroyer(arr) {
var args = Array.from(arguments);
var test = arr.filter(function(val){
return !args.includes(val);
});
return test;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
In the variable “test”, I understand that arr refers to arr[0] by default, but how does “args” work inside the filter method?
Because from my understanding, arr[0] is basically [1, 2, 3, 1, 2, 3] – but args is the whole arguments array [[1, 2, 3, 1, 2, 3], 2, 3]. How is [1, 2, 3, 1, 2, 3] not cancelled out by filter?
I hope that makes sense. Thanks in advance!