update snippets 32-47
This commit is contained in:
committed by
Agamemnon Zorbas
parent
3994e12792
commit
0001ff4dcb
@ -8,5 +8,8 @@ Use `Array.reduce()` to add values into the array, using the sum of the last two
|
||||
```js
|
||||
const fibonacci = n =>
|
||||
Array.from({ length: n}).reduce((acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), []);
|
||||
// fibonacci(5) -> [0,1,1,2,3]
|
||||
```
|
||||
|
||||
```js
|
||||
factorial(6) -> 720
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user