two-way generator
2022年5月1日小于 1 分钟
two-way generator
Question
What does the code snippet to the right output by console.log
?
Snippet
function* gen() {
yield 2 * (yield 100)
}
const generator = gen()
console.log(generator.next().value)
console.log(generator.next(1).value)
console.log(generator.next(1).value)