Skip to content

Instantly share code, notes, and snippets.

@zlatkov
Created March 11, 2021 12:34
Show Gist options
  • Save zlatkov/b1e4739be97dd8f33aeecf47b6b86730 to your computer and use it in GitHub Desktop.
Save zlatkov/b1e4739be97dd8f33aeecf47b6b86730 to your computer and use it in GitHub Desktop.
let fibonacciSequenceIterator = makeFibonacciSequenceIterator(5); // Generates the first 5 numbers.
let result = fibonacciSequenceIterator.next();
while (!result.done) {
console.log(result.value); // 1 1 2 3 5 8
result = fibonacciSequenceIterator.next();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment