Travis build: 391
This commit is contained in:
@ -7,9 +7,12 @@ 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), []);
|
||||
Array.from({ length: n }).reduce(
|
||||
(acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i),
|
||||
[]
|
||||
);
|
||||
```
|
||||
|
||||
```js
|
||||
fibonacci(6) // 720
|
||||
fibonacci(6); // 720
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user