mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-25 03:02:21 +00:00
fix: function Fibonacci2 bug
This commit is contained in:
parent
baabc6fc2c
commit
a33b928158
@ -1230,7 +1230,7 @@ Fibonacci(10); // 89
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
function Fibonacci2 (n , ac1 = 1 , ac2 = 1) {
|
function Fibonacci2 (n , ac1 = 1 , ac2 = 1) {
|
||||||
if( n <= 1 ) {return ac1};
|
if( n <= 1 ) {return ac2};
|
||||||
|
|
||||||
return Fibonacci2 (n-1 , ac2 , ac1 + ac2);
|
return Fibonacci2 (n-1 , ac2 , ac1 + ac2);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user