loading
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function *numbersWithStep(step, max) {
  let number = 0
  number+= step
  while (number <= max) {
    yield number;
    number = number + step
  }
}

const generatorInstance = numbersWithStep(2, 10)

console.log(generatorInstance.next())
console.log(generatorInstance.next())


for(let n of numbersWithStep(1, 10)){
  console.log(n)
}
Fetching token