Rekursiv könnte das so ausehen,
auch nicht unbedingt schöner
Ausserdem muesste man dann
strenggenommen das if auch noch
ersetzen.
ActionScript:
Function.prototype.loop = function(x) {
if(x-- <= 0) return null;
//
var f = this;
return function () {
f.apply(f, arguments);
f.loop(x).apply(f, arguments);
};
};
a = function (x, y) {
trace(x + " " + y);
};
a.loop(10)("helo", "world");
mfg r.