Javascript Array indexByAction(predicate)

Description

Javascript Array indexByAction(predicate)




/* Extension Methods */

Array.prototype.indexByAction = function(predicate){
 for (var i = 0; i < this.length; i++) {
  if (predicate( this[i]))
   return i;//w  w  w.  j ava 2s.  c  om
 };
 return -1;
}



PreviousNext

Related