Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function destroyer(arr) {
- // Remove all the values
- var args = Array.from(arguments); //converts arguments to an array
- console.log(args);
- var firstArg = args.shift();
- console.log(firstArg);
- function isntThere(value) {
- for (var i = 0; i < args.length; ++i) {
- if (value == args[i]) {
- return true;
- }
- }
- }
- var arrNew = firstArg.filter(isntThere);
- //console.log(firstArg);
- console.log(arrNew);
- return arrNew;
- //return arr;
- }
- destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement