Javascript Number times(callback, context)

Description

Javascript Number times(callback, context)


Number.prototype.times = function(callback, context) {
  context = context || this;//from   w ww  .  j  a v  a  2s.com
  for (var i = 0; i < this; i += 1) {
    var n = i + 1;
    callback.call(context, n, context);
  }
};



PreviousNext

Related