Javascript Array findexOf(f)

Description

Javascript Array findexOf(f)


Array.prototype.findexOf = function(f){

  for(var i=0; i<this.length; ++i){
    var e = this[i];

    if(f(e)){//www . j  a  v a  2s  .  co m
      return i;
    }
  }
  
  return -1;
};



PreviousNext

Related