JSFiddle - React, Tailwind, and code Playground
JavaScript
// Works in Chrome IF you "Enable Experimental JavaScript" under the flags chrome://flags/
// Does not work in FF due to different implementations of iterators
// Note the *
function* fib() {
var i = 0, j = 1;
while (true) {
yield i;
var t = i;
i = j;
j += t;
}
}
var iterator = fib();
for (var i = 0; i < 10; i++) {
// Note the ".value"
console.log(iterator.next().value);
}