Nodejs Function Call times(object)

Here you can find the source of times(object)

Method Source Code

// Takes an object, gives back a list with the object repeated "this" times.
Number.prototype.times = function(object){
   var l = [];//from www  . j  a v a  2 s .c om
   this.timesRepeat(function(){l.push(object)});
   return l;
}

Related

  1. times(callback)
    Number.prototype.times = function(callback) {
      for (var i = 0; i < this; i++) {
        callback.call(this, i);
      return this;
    };
    
  2. times(callback)
    Number.prototype.times = function(callback) {
      var i;
      if(typeof callback === 'undefined') {
        var array = [];
        for(i = 0; i < this; i++) array.push(i);
        return array;
      }  else if(typeof callback === 'function')  {
        for(i = 0; i < this; i++) callback(i);
      } else {
    ...
    
  3. times(cb)
    Number.prototype.times = function (cb) {
      var i = -1;
      while (++i < this) {
        cb(i);
      return +this;
    };
    
  4. times(cb)
    Number.prototype.times = function(cb) {
      var i = -1;
      while (++i < this) { cb(i); }
      return +this;
    };
    
  5. times(cb)
    Number.prototype.times = function(cb) { 
      for (var i = 0; i < this; i++) cb(i);
    };
    
  6. timesDo(callback)
    Number.prototype.timesDo = function (callback) {
        if (callback) {
            for (var i = 0; i < this; i++) {
                callback.call();
    };