0

what is the simplest form to out pt this program

var yourself = { fibonacci : function(n) { if (n === 0) { return 0; } else if (n === 1) { return 1; } else { return this.fibonacci(n - 1) + this.fibonacci(n - 2); } } };

16th Dec 2019, 2:55 AM
Olusegun Omoni
Olusegun Omoni - avatar
5 Respuestas
+ 1
`window` is a native Javascript object, you don't need to define it, it's already available. Yes that was ten, just a randomly picked number. You can use any number.
16th Dec 2019, 5:14 AM
Ipang
0
By calling the method? window.onload=function() { console.log(yourself.fibonacci(10)); }
16th Dec 2019, 3:35 AM
Ipang
0
window is not defined
16th Dec 2019, 3:40 AM
Olusegun Omoni
Olusegun Omoni - avatar
0
is this (10) as in ten
16th Dec 2019, 3:42 AM
Olusegun Omoni
Olusegun Omoni - avatar
0
ok
16th Dec 2019, 8:41 AM
Olusegun Omoni
Olusegun Omoni - avatar