Created
April 26, 2012 04:32
-
-
Save mcsheffrey/2495844 to your computer and use it in GitHub Desktop.
Find object in array - http://stackoverflow.com/questions/237104/array-containsobj-in-javascript
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
contains(a, obj) { | |
for (var i = 0; i < a.length; i++) { | |
if (a[i] === obj) { | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment