create "array.indexOf" function in IE


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // create "Array.indexOf" function in IE
  2. if(!Array.prototype.indexOf){
  3. Array.prototype.indexOf=function(obj,start){
  4. for(var i=(start||0),j=this.length;i<j;i++){
  5. if(this[i]==obj){return i;}
  6. }
  7. return -1;
  8. }
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.