times

times(iterator) -> Number

Encapsulates a regular [0..n[ loop, Ruby-style.

The callback function is invoked with a single argument, ranging from 0 to the number, exclusive.

Examples


var s = '';
(5).times(function(n) {
  s += n;
});

s
// -> '01234'