Skip to content

Instantly share code, notes, and snippets.

@dongerardor
Created March 25, 2013 19:44
Show Gist options
  • Save dongerardor/5240021 to your computer and use it in GitHub Desktop.
Save dongerardor/5240021 to your computer and use it in GitHub Desktop.
javascript array method "indexOf" doesn't exists in IE, so this code implements this.
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment