How to use filter and return values not found in an array from another array

Tell us what’s happening:

How can I check/pass into the return statement inside the filter for the content of the array for different values, instead of passing individual values.

Your code so far

function destroyer(arr) {
  //let a = (arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments));  // converting arguments to a real array

  // 1. ES2015 method of converting arguments to a real array
  var a = Array.from(arguments);  //

  var b = a .slice(1);

  var c = arr.filter(function(es) {

    return  es !== 2 && es !== 3;

  });
  
  return c;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36.

Link to the challenge:

function destroyer(arr) {
  // Remove all the values


  //let a = (arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments));  // converting arguments to a real array

  // 1. ES2015 method of converting arguments to a real array
  let a = Array.from(arguments);  //

  let b = a .slice(1);

  let c = arr.filter(function(es) {

    for(let elem of b) {
      return  es !== elem;
    }

  });


  return c;
}




console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3));

this only return [1,3,1,3]
am sure the loop exit immediately it find 2 so it does not check the 3. other wise it would have return [1.1]

how do I prevent that?

thanks

Thanks I will into that. i will let you know.

Thanks I figured it out with indexOf