Skip to content

Instantly share code, notes, and snippets.

Created Jul 22, 2013
What would you like to do?
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