function* fib(a=0, b=1) { while (true) { yield a ;[a, b] = [b, a + b] } } let fibs = fib() for (let i = 0; i < 10; i++) { console.log(fibs.next().value) }
To embed this project on your website, copy the following code and paste it into your website's HTML: