Hello, I am new to this whole programming thing and struggling with algorithms right now.
I have come up with this solution, however I can’t seem to get the return part of my filter function right.
function destroyer(arr) {
// Remove all the values
//turn arguments into array, starting from the second (1) arg
var args = Array.prototype.slice.call(arguments,1);//filter function, return value that doesn't match the arguments function destroyThis(val){ for (var i = 0; i < args.length; i ++){ //return args.indexOf(x) === -1; **return val != args[i];** } } //filter the working array arr = arr.filter(destroyThis); return arr; }
Can anyone help me with the bold part? My current solution only check the last of the arguments.
Much appreciate.