1 2 3 4 5 6 7 8 9 10 11 |
const gfc = function*(limit) { for (let i = 0; i < limit; i++) { yield i; } }; const g = gfc(5); for (const v of g) { console.log(v); } |
1 2 3 4 5 |
0 1 2 3 4 |
1 2 3 4 5 6 7 8 9 10 11 |
const gfc = function*(limit) { for (let i = 0; i < limit; i++) { yield i; } }; const g = gfc(5); for (const v of g) { console.log(v); } |
1 2 3 4 5 |
0 1 2 3 4 |