Javascript Array find(criteria)

Description

Javascript Array find(criteria)


Array.prototype.find = function(criteria) {
  for (var i = 0; i < this.length; i++) {
    if (criteria(this[i])) {
      return this[i]
    }//from  w ww  . j a v a 2  s .  c om
  }
  return null
}



PreviousNext

Related