hey all!
so after struggling for a long while on these boolean questions i looked at the answer after checking the code and reading the walk through of why i couldn’t figure out a few things. can anyone help me wrap my head around this. thanks in advance
function destroyer(arr) {
//arguments?? its just a common variable? what is going on
var realArr = Array.prototype.slice.call(arguments);
//basic nested for loops, pretty casual
for (var i = 0; i < arr.length; i++){
for(var j = 0; j< realArr.length; j++){
if( arr[i] === realArr[j]){
//oh you can just call delete.... didnt know that
delete arr[i];
}
}}
//here is where i am totally lost. what just happened?
//filtering Boolean false? and what happened to the other
//two object arguments? they get filtered out below?
return arr.filter(Boolean);
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);