Here you can find the source of times(iterator)
/**//from ww w. ja v a 2 s . com * Runs the given iterator N times * @module Number * @param {function} iterator * @example * (2).times(function(){ }); **/ Number.prototype.times = function(iterator) { var index = 0; while(index < this) iterator(index++); return this };
'use strict'; Number.prototype.times = function(fn) { if (this.valueOf()) { for (var i = 0; i < this.valueOf(); i++) { fn(i); }; function repeat(n, fn) { ...
var i = 0; Number.prototype.times = function(func) { let n = Math.round(this); if (n <= 0) return null; func(); return (n - 1).times(func); console.log(i);
Number.prototype.times = function (func) { var i; for (i = 0; i < this; i += 1) { func(); }; function random(min, max) { var floor = +min, ceil = +max; ...
Number.prototype.times = function(func, scope) { var i, v, _results; v = this.valueOf(); i = 0; _results = []; while (i < v) { func.call(scope || window, i); _results.push(i++); return _results; };
Number.prototype.times = function(handler) { var index = 0; while(index < this) handler(index++); return this };
Number.prototype.times = function (iterator) { for (var i = 0; i < this; i++) { iterator(i); };
Number.prototype.times = function(iterator, context) { for (var i = 0; i < this; i++) iterator.call(context, i); }; Number.prototype.seconds = function() { return this * 1000; }; Number.prototype.minutes = function() { return this * 1000 * 60; }; Number.prototype.hours = function() { return this * 1000 * 3600; }; Number.prototype.days = function() { return this * 1000 * 3600 * 24; };
Number.prototype.times = function(iterator, context) { for(var i = 0; i < this; i++) { iterator.call(context, i); return i; };
"use strict"; Number.prototype.times = function(action) { var i; for (i = 1; i <= this; i++) { action(); }; (5).times(function () { console.log("OMG!"); });