Created
August 15, 2012 22:25
-
-
Save jamiehs/3364281 to your computer and use it in GitHub Desktop.
jQuery Array Intersect One Liner
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
// Find the common intersection between the arrays | |
a1=[1,2,3] | |
a2=[2,3,4,5] | |
$.map(a1,function(a){return $.inArray(a, a2) < 0 ? null : a;}) | |
// http://stackoverflow.com/a/9401775/24559 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment