Change all snippets from var to const
This commit is contained in:
@ -4,7 +4,7 @@ Create an empty array of the specific length, initializing the first two values
|
||||
Use `reduce()` to add values into the array, using the sum of the last two values, except for the first two.
|
||||
|
||||
```js
|
||||
var fibonacci = n =>
|
||||
const fibonacci = n =>
|
||||
Array.apply(null, [0,1].concat(Array(n-2))).reduce(
|
||||
(acc, val, i) => {
|
||||
acc.push( i>1 ? acc[i-1]+acc[i-2] : val);
|
||||
|
||||
Reference in New Issue
Block a user