Skip to content

Instantly share code, notes, and snippets.

@bhrott
Created September 18, 2015 19:08
Show Gist options
  • Save bhrott/7bca5c3da50b7a5be4cc to your computer and use it in GitHub Desktop.
Save bhrott/7bca5c3da50b7a5be4cc to your computer and use it in GitHub Desktop.
Function to check if an object is in the array
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