Skip to content

Instantly share code, notes, and snippets.

@vkareh
Created July 22, 2013 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vkareh/6054262 to your computer and use it in GitHub Desktop.
Save vkareh/6054262 to your computer and use it in GitHub Desktop.
if (!('indexOf' in Array.prototype)) {
Array.prototype.indexOf= function(find, i) {
if (i===undefined) i= 0;
if (i<0) i+= this.length;
if (i<0) i= 0;
for (var n= this.length; i<n; i++)
if (i in this && this[i]===find)
return i;
return -1;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment