1function* g(){ //or function *g(){}
2 console.log("First");
3 yield 1;
4 console.log("second");
5 yield 2;
6 console.log("third");
7}
8let generator=g();
9generator.next();
10generator.next();
1function* makeRangeIterator(start = 0, end = 100, step = 1) {
2 let iterationCount = 0;
3 for (let i = start; i < end; i += step) {
4 iterationCount++;
5 yield i;
6 }
7 return iterationCount;
8}