Skip to content

Instantly share code, notes, and snippets.

@ernestohs
Created August 24, 2012 16:36
Show Gist options
  • Save ernestohs/3452638 to your computer and use it in GitHub Desktop.
Save ernestohs/3452638 to your computer and use it in GitHub Desktop.
if IndexOf isn't defined on IE
indexOf4Array = function () {
if (!Array.indexOf) {
Array.prototype.indexOf = function(obj) {
var length = this.length;
for (var i = 0; i < length; 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