Created
December 27, 2021 06:45
-
-
Save hoyangtsai/3fd815bc9870eb5f9122b8947feffc39 to your computer and use it in GitHub Desktop.
Get differences of two arrays #snippet #array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.diff = function(a) { | |
return this.filter(function(i) {return a.indexOf(i) < 0;}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Answer found at here