Javascript Number times(func, scope)

Description

Javascript Number times(func, scope)



Number.prototype.times = function(func, scope) {
  var i, v, _results;

  v = this.valueOf();/*from w  w w .  j  a v  a2 s .c  om*/
  i = 0;
  _results = [];
  while (i < v) {
    func.call(scope || window, i);
    _results.push(i++);
  }
  return _results;
};



PreviousNext

Related