Skip to content

Instantly share code, notes, and snippets.

View neagle's full-sized avatar

Nate Eagle neagle

View GitHub Profile
@neagle
neagle / Array.prototype.indexOf()
Created February 27, 2012 22:00
Shim for 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;
}
}