SOURCE

function* test() {
    var a = yield 1
    console.log(a)
    var b = yield 2
    console.log(b)
    var c = a + b
    console.log(c)
}
var generator = test()
console.log(generator)
var step1 = generator.next()
console.log(step1,'step1')
var step2 = generator.next(step1.value)
console.log(step2)
var step3 = generator.next(step2.value)
console.log(step3)
console 命令行工具 X clear

                    
>
console