+ 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));
1 ответ
+ 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