Generator function
function*idMaker () {
let id = 0
while (true) { yield id++ }
}
let gen = idMaker()
gen.next().value // â 0
gen.next().value // â 1
gen.next().value // â 2
it's complicated. See: Generators
Comments
function*idMaker () {
let id = 0
while (true) { yield id++ }
}
let gen = idMaker()
gen.next().value // â 0
gen.next().value // â 1
gen.next().value // â 2
it's complicated. See: Generators