Created
July 30, 2020 22:31
-
-
Save ahafidi/fbb3d0a3ad650cce431089a37d72ce48 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fibonacci = n => | |
| [...Array(n)].reduce( | |
| (acc, val, i) => acc.concat( // concat returns the new acc | |
| i > 1 | |
| ? acc[i - 1] + acc[i - 2] | |
| : i | |
| ), | |
| [] | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment