js gnerator code example
Example 1: 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();
Example 2: function generator js
function* name([param[, param[, ... param]]]) {
statements
}