Hier wieder eine kleine Aufgabe für unsere Azubis.
function A(p) {
this.f = function(n) {
return this[n] || (this[n] = p(this.f(n-1),this.f(n-2)))
}
}
function B(p) {
A.call(this,p);
for (var i = 0; (this[i] = B.arguments[++i]); ); }
B.prototype = new A;
function f(n) {
return (new B(function(x,y){return(x+y)},1,1)).f(n);
}
f(17)
?
Einen Kommentar schreiben