Skip to content

Instantly share code, notes, and snippets.

@mgechev
Last active December 20, 2015 23:08
Show Gist options
  • Select an option

  • Save mgechev/6210001 to your computer and use it in GitHub Desktop.

Select an option

Save mgechev/6210001 to your computer and use it in GitHub Desktop.
Array pull with primitives
function pullPrimitives(arr) {
var map = {},
res = [],
len = arr.length,
args = arguments,
current;
for (var i = 1, argsLen = args.length; i < argsLen; i++) {
map[args[i]] = true;
}
for (i = 0; i < len; i++) {
current = arr[i];
if (!map[current]) {
res.push(current);
}
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment