Javascript Array index(iterator, context)

Description

Javascript Array index(iterator, context)


Array.prototype.index = function (iterator, context) {
  for(var i in this) {
    if(iterator(this[i])) { return i; } // TODO: context is not handled
  }//from  w ww.  ja v  a  2  s. co  m
  return null;
}



PreviousNext

Related