Hi all,
I finished the Seek and Destroy challenge (eg. passed the tests), but I don’t feel great about my solution. Something about it feels clunky and bloated.
Can you see anything obvious that would improve my code?
function remover(arr, toRemove) {
var removed = arr.filter(function(val){
if (val == toRemove) {
return false;
} else {
return true;
}
});
return removed;
}
function destroyer(arr) {
cleanArr = arguments[0];
console.log(cleanArr);
for (var i = 1; i < arguments.length; i++) {
cleanArr = remover(cleanArr, arguments[i]);
}
console.log(cleanArr);
return cleanArr;
}
Thanks