Nodejs Utililty Methods Array Take

List of utility methods to do Array Take

Description

The list of methods to do Array Take are organized into topic(s).

Method

takeWhile(predicate)
Array.prototype.takeWhile = function (predicate) {
  predicate = predicate || Predicate;
  var l = this.length;
  var arr = [];
  for (var i = 0; i < l && predicate(this[i], i) === true ; i++)
    arr.push(this[i]);
  return arr;
};