+ 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 Réponse
+ 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