genarate() in js code example
Example: generators in javascript
function* g(){ //or function *g(){}
console.log("First");
yield 1;
console.log("second");
yield 2;
console.log("third");
}
let generator=g();
generator.next();
generator.next();