/ Published in: JavaScript
The Number objects value determines how often the supplied function is repeated. Inspired by ROR & Python. "Pollutes" Number's prototype.
Expand |
Embed | Plain Text
Number.prototype.times = function(fn) { var i = (this > 0) ? this : 0; while (i--) { fn(); } }
You need to login to post a comment.
