Skip to content

Instantly share code, notes, and snippets.

@mdixon47
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save mdixon47/e1ff0079b3e8c83f5180 to your computer and use it in GitHub Desktop.

Select an option

Save mdixon47/e1ff0079b3e8c83f5180 to your computer and use it in GitHub Desktop.
FCC Diff Two Arrays Challenge
function diff(arr1, arr2) {
return arr1.filter(function (e) { return arr2.indexOf(e) < 0; }).concat(arr2.filter(function (e) { return arr1.indexOf(e) < 0; }));
}
diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment