Skip to content

Instantly share code, notes, and snippets.

@juanpujol
Created January 4, 2013 17:16
Show Gist options
  • Save juanpujol/4454282 to your computer and use it in GitHub Desktop.
Save juanpujol/4454282 to your computer and use it in GitHub Desktop.
Add method contains to Array Prototype.
// Add method contains to Array Prototype.
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