Skip to content

Instantly share code, notes, and snippets.

@zxsanny
Created March 1, 2017 14:42
Show Gist options
  • Save zxsanny/2bf414c92ff21d008a4765177574c146 to your computer and use it in GitHub Desktop.
Save zxsanny/2bf414c92ff21d008a4765177574c146 to your computer and use it in GitHub Desktop.
function zxdiff(arr, arrDiff, propFn) {
var hash = [];
for (var x = 0; x < arrDiff.length; x++) {
hash[propFn(arrDiff[x])] = true;
}
var res = [];
for (var i = 0; i < arr.length; i++) {
if (!hash[ propFn(arr[i]) ]) {
res.push(arr[i]);
}
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment