JSFiddle - React, Tailwind, and code Playground

by dmitri_pavlutin

JavaScript

const obj = {
  *indexGenerator() {
    var index = 0;
    while(true) {
      yield index++;
    }
  }
}
const g = obj.indexGenerator();
console.log(g.next().value); // => 0
console.log(g.next().value); // => 1