Skip to content

Instantly share code, notes, and snippets.

@rd13
Created November 15, 2012 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rd13/4079164 to your computer and use it in GitHub Desktop.
Save rd13/4079164 to your computer and use it in GitHub Desktop.
in_array function in Javascript
Array.prototype.contains = function(obj) {
var i = this.length;
while (i--) {
if (this[i] === obj) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment