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

28th Aug 2022, 3:33 PM
steve Purpose
steve  Purpose - avatar
1 ответ
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
8th Oct 2022, 12:00 PM
SoloProg
SoloProg - avatar