Skip to content

Instantly share code, notes, and snippets.

Avatar

Nate Eagle neagle

View GitHub Profile
@neagle
neagle / Array.prototype.indexOf()
Created Feb 27, 2012
Shim for Array.prototype.indexOf()
View Array.prototype.indexOf()
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;
}
}
You can’t perform that action at this time.