Skip to content

Instantly share code, notes, and snippets.

@jfsiii
Created October 6, 2010 20:02
Show Gist options
  • Save jfsiii/613972 to your computer and use it in GitHub Desktop.
Save jfsiii/613972 to your computer and use it in GitHub Desktop.
if (!Array.prototype.indexOf)
{
Array.prototype.indexOf = function( search, from )
{
var len = this.length;
from = ~~from || 0;
if (from < 0){ from += len; }
for (; from < len; from++){
if (this[from] === search){ return from; }
}
return -1;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment