Created
August 7, 2020 17:13
-
-
Save gthrm/7274dc2bf8149944f8360325a6673642 to your computer and use it in GitHub Desktop.
fibonachchiGenerator
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* fibonachchi() { | |
| let index = 0; | |
| while (true) { | |
| yield index < 2 ? 0 : index - 1 + (index - 2); | |
| index++; | |
| } | |
| } | |
| const fibonachchiGen = fibonachchi(); | |
| console.log(fibonachchiGen.next()); | |
| console.log(fibonachchiGen.next()); | |
| console.log(fibonachchiGen.next()); | |
| console.log(fibonachchiGen.next()); | |
| console.log(fibonachchiGen.next()); | |
| console.log(fibonachchiGen.next()); | |
| console.log(fibonachchiGen.next()); | |
| console.log(fibonachchiGen.next()); | |
| console.log(fibonachchiGen.next()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment