Created
December 21, 2016 16:29
-
-
Save newmanbrad/c0621e149cf33360d52f67704e876ee8 to your computer and use it in GitHub Desktop.
Check if sub-strings are in an array of strings.
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
function inArray(arr1, arr2) { | |
return arr1.filter(function(needle) { | |
return arr2.some(function(haystack) { | |
return haystack.indexOf(needle) > -1; | |
}); | |
}).sort(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment