Created
September 18, 2015 19:08
-
-
Save bhrott/7bca5c3da50b7a5be4cc to your computer and use it in GitHub Desktop.
Function to check if an object is in the array
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
Array.prototype.contains = function (needle) { | |
for (i in this) { | |
if (this[i] == needle) return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment