Skip to main content
100%

JS Bin

✓ Published0🌍 Public
Aaciurea
Last edited May 16, 2017
Created on May 16, 2017

This example demonstrates the Fibonacci sequence through a custom JavaScript iterator. The code defines an object with a `[Symbol.iterator]` method that generates successive Fibonacci numbers, logging each value to the console. A `for...of` loop consumes the iterator and breaks once a value exceeds 50, triggering the iterator’s `return` method to log "finished---". The example uses native JavaScript iteration protocols rather than any external libraries, with console output as the only visualization.

AI-generated description

Similar vizzes