0
Why must num and array be initialized in parentheses?
Please I saw this code listing Fibonacci sequence numbers using recursion named fib sequence 1 When I try to rewrite it in fib sequence 2 and 3 codes it doesn't work,why is this?. https://code.sololearn.com/W0B90pLH9BYm/?ref=app https://code.sololearn.com/Wd5EeG85skr4/?ref=app https://code.sololearn.com/WkOvCJ6tRnDn/?ref=app
1 Answer
0
f = (x) => {
if (x<=1) return x;
else return f(x-1)+f(x-2);
}
window.onload = () => {
let mx = 10;
for (n=0; n<mx; n++)
document.write ( f(n) + "<br>");
}
https://www.sololearn.com/compiler-playground/WVdUsq9zeuPh