Javascript Number upto(n, f)

Description

Javascript Number upto(n, f)

Number.prototype.upto = function (n, f) { 
    for (var i = Number(this); i <= n; ++i) f(i); 
};

1..upto(10, i => console.log(i));// ww w .  j a va 2 s . c om



PreviousNext

Related