Skip to content

Instantly share code, notes, and snippets.

@hoyangtsai
Created December 27, 2021 06:45
Show Gist options
  • Save hoyangtsai/3fd815bc9870eb5f9122b8947feffc39 to your computer and use it in GitHub Desktop.
Save hoyangtsai/3fd815bc9870eb5f9122b8947feffc39 to your computer and use it in GitHub Desktop.
Get differences of two arrays #snippet #array
Array.prototype.diff = function(a) {
return this.filter(function(i) {return a.indexOf(i) < 0;});
};
@hoyangtsai
Copy link
Author

Answer found at here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment