In continuation of my previous post here is my implementation of times
method of then Number
object.
Number.prototype.times = function (f) {
(function (i) {
i && arguments.callee(--i) && f(i);
return true;
})(this);
};
The idea is that you should be able to write code like this one:
var a = [4, 2, 6, 1, 8, 0];
a.length.times(function (i) {
alert(a[i]);
});