Javascript Array findAll(predicate)

Description

Javascript Array findAll(predicate)

Array.prototype.findAll = function(predicate) {
 var found = new Array();
 this.forEach(function(current) {
  if (predicate(current)) {
   found.push(current);/*from  www .ja  va2 s .com*/
  }
 });

 return found;
};



PreviousNext

Related