I’ve read the solutions to Seek & Destroy (https://forum.freecodecamp.com/t/algorithm-seek-and-destroy/16046).
In the intermediate solution, it uses this answer:
function destroyer(arr) {
// Remove all the values
var args = Array.from(arguments).slice(1);
return arr.filter(function(val) {
return !args.includes(val);
});
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Specifically, I don’t understand this line at all Array.from(arguments).slice(1);
I understand that it’s trying to make ([1,2,3,1,2,3],2,3) into an array, but why does it use (arguments) instead of (arr)?
If anyone would be so kind to explain it clearly to me! Feeling baffled !