Last active
April 7, 2019 08:59
-
-
Save ZackFox/c3c51a57e2941a4fcaaa28c82e409d22 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
| function fibonacci(n){ | |
| if (n <= 1) return n; | |
| let a = 0, b = 1, res; | |
| for(let i = 1; i < n; i++){ | |
| res = a + b; | |
| a = b; | |
| b = res; | |
| } | |
| return res; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment