Last active
December 15, 2017 09:51
-
-
Save asciimo/277b54ca3fac8da167da40bc2907a9b6 to your computer and use it in GitHub Desktop.
ES6 equivalent to PHP's array_intersect()
This file contains 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 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