function* counter(low, high, step) { let current = low; while (current <= high) { yield current; current += step; }}for (let c of counter(3, 9, 2)) { console.log(c);}//printed 3, 5, 7, 9