Advertisement
Guest User

seek and destroy

a guest
May 14th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function destroyer(arr) {
  2.   // Remove all the values
  3.     var args = Array.from(arguments); //converts arguments to an array
  4.    console.log(args);
  5.   var firstArg = args.shift();
  6.  
  7.       console.log(firstArg);
  8.     function isntThere(value) {
  9.      for (var i = 0; i < args.length; ++i) {
  10.        if (value == args[i]) {
  11.          return true;
  12.        }
  13.        }
  14.       }
  15.    
  16.   var arrNew = firstArg.filter(isntThere);
  17.  
  18.   //console.log(firstArg);
  19.   console.log(arrNew);
  20.    return arrNew;
  21.   //return arr;
  22. }
  23.  
  24. destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement