Javascript Array selects(cond)

Description

Javascript Array selects(cond)

Array.prototype.selects = function (cond) {
  var results = [];
  this.forEach(function (el) {
    if (cond(el)) {
      results.push(el);//  ww w.  j  a  v  a  2s. c om
    }
  });
  return results
}



PreviousNext

Related