function* iter() {
let i = 0;
while(true) yield i;
}
let numbers = iter();
numbers.next()
// -> null
// This works:
var iter;
function defIter() {
iter = function* () {
let i = 0;
while(true) yield i++;
}
}
defIter()
let numbers = iter();
iter.next().value
// 0
Probably due to how we parse and rewrite the code.
Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
Probably due to how we parse and rewrite the code.