Skip to content

Instantly share code, notes, and snippets.

@jamiehs
Created August 15, 2012 22:25
Show Gist options
  • Save jamiehs/3364281 to your computer and use it in GitHub Desktop.
Save jamiehs/3364281 to your computer and use it in GitHub Desktop.
jQuery Array Intersect One Liner
// 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