+ 1

Can someone explain this code

function fib(num) { if(num<=2) return 1; return fib(num-1)+fib(num-2); } document.write(fib(6));

31st Jul 2018, 3:20 PM
CŠ»aŠ²eŠ½ Š‚ŠµŃ€Š²ŠøŠ“Š°
CŠ»aŠ²eŠ½ Š‚ŠµŃ€Š²ŠøŠ“Š° - avatar
1 Answer
+ 5
fib(6) fib(5) + fib(4) fib(4) + fib(3) + fib(3) + fib(2) fib(3) + fib(2) + fib(2) + fib(1) + fib(2) + fib(1) + 1 fib(2) + fib(1) + 1 + 1 + 1 + 1 + 1 + 1 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 8
31st Jul 2018, 7:56 PM
Mert Yazıcı
Mert Yazıcı - avatar