Posted By

shodan_uk on 03/29/11


Tagged

javascript array


Versions (?)

Array.indexof


 / Published in: JavaScript
 

  1. if(!Array.indexOf){
  2. Array.prototype.indexOf = function(obj){
  3. for(var i=0, len=this.length; i<len; i++){
  4. if(this[i]==obj){
  5. return i;
  6. }
  7. }
  8. return -1;
  9. }
  10. }

Report this snippet  

You need to login to post a comment.