Skip to content

Instantly share code, notes, and snippets.

@asciimo
Last active December 15, 2017 09:51
Show Gist options
  • Save asciimo/277b54ca3fac8da167da40bc2907a9b6 to your computer and use it in GitHub Desktop.
Save asciimo/277b54ca3fac8da167da40bc2907a9b6 to your computer and use it in GitHub Desktop.
ES6 equivalent to PHP's array_intersect()
const intersect = (leftArray, rightArray) => leftArray.filter(value => rightArray.indexOf(value) > -1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment