1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 18:32:22 +00:00

docs(function): edit tail optimization

This commit is contained in:
ruanyf 2016-07-15 20:36:23 +08:00
parent dff4d65aba
commit 4fb1525a36

View File

@ -1232,11 +1232,11 @@ Fibonacci(10); // 89
function Fibonacci2 (n , ac1 = 1 , ac2 = 1) { function Fibonacci2 (n , ac1 = 1 , ac2 = 1) {
if( n <= 1 ) {return ac2}; if( n <= 1 ) {return ac2};
return Fibonacci2 (n-1 , ac2 , ac1 + ac2); return Fibonacci2 (n - 1, ac2, ac1 + ac2);
} }
Fibonacci2(100) // 354224848179262000000 Fibonacci2(100) // 573147844013817200000
Fibonacci2(1000) // 4.346655768693743e+208 Fibonacci2(1000) // 7.0330367711422765e+208
Fibonacci2(10000) // Infinity Fibonacci2(10000) // Infinity
``` ```