js how to run a generatoer code example
Example 1: function generator js
function* name([param[, param[, ... param]]]) {
statements
}
Example 2: JavaScript — Generators
function* makeRangeIterator(start = 0, end = 100, step = 1) {
let iterationCount = 0;
for (let i = start; i < end; i += step) {
iterationCount++;
yield i;
}
return iterationCount;
}