I am a javascript beginner trying to solve a challenge posed by an online code camp. This problem is similar to that posed at Using an array to filter an array Javascript. I have studied this but remain unsuccessful. I have tried for many hours without arriving at a solution.
The exact challenge states:
Remove all values (last argument(s)) from an array (first argument) and >return as a new array.
I know this is not much to go on. In the example below, the desired output would be the following array:
[1,1]
The basic premise is to filter the first argument, which is an array, by x number of non-array arguments. Where the array elements are the same as the non-array arguments, those elements would be removed from the array. Below is a non-functioning sample of a path I've attempted:
<code>
     function result(arr) {
  var list = [];
  var i;
  for(i in Object.keys(arguments)) {
      if(i > 0) {
          list.push(arguments[i]);
      }
  }
  function answer(arr1, arr2) {
    return arr1.filter(function(a) {
        return arr2.indexOf(a) >= 0;
    });
  }
  return answer(arr, list);
}
result([1, 2, 3, 1, 2, 3], 2, 3); 
</code>
 
     
     
     
    