Created
February 13, 2019 09:15
-
-
Save imparvez/eeb41735defb610253559507f6682b6e to your computer and use it in GitHub Desktop.
Return the difference between two Arrays
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
const difference = (a, b) => { | |
const s = new Set(b) | |
return a.filter(x => !s.has(x)) | |
} | |
difference([1,2,3], [1,2,4]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment