Tell us what’s happening:
Hello everyone,
I not stuck here but, I came along the documentation of the arguments object and copied the lineArray.from(arguments).slice(1);
both functions seem to work for all of the tests, but I barely understand why the second one is working. Can somebody help me?
Your code so far
function destroyer(arr) {
var args = Array.from(arguments).slice(1);
return arr.filter((item) =>{
return !args.includes(item)
});
}
function destroyer(arr) {
var args = Array.prototype.slice.call(arguments);
return arr.filter((item) =>{
return !args.includes(item)
});
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36
.
Challenge: Seek and Destroy
Link to the challenge: