Array returns blank, I’ve been trying to see the problem (for 30 minutes) but I guess I don’t have the eye for it yet!
//GOAL: erase all destroyer[1, 2] values in destroyer[0]
function destroyer(array) {
//filter non-targeted elements into a new array and then return it.
var x = array[1];
var y = array[2];
var new_arr = [];
for (var p = 0; p < array[0].length; p++) {
new_arr = array.filter(function anon() {
return (x !== array[0][p] && y !== array[0][p]);
});
}
return new_arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);