Skip to content

Instantly share code, notes, and snippets.

@imparvez
Created February 13, 2019 09:15
Show Gist options
  • Save imparvez/eeb41735defb610253559507f6682b6e to your computer and use it in GitHub Desktop.
Save imparvez/eeb41735defb610253559507f6682b6e to your computer and use it in GitHub Desktop.
Return the difference between two Arrays
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