1.全体传入参数
function * gen(args){
console.log(args);
yield '111'
yield '222'
yield '333'
}
let iterator = gen('AAA')
console.log(iterator.next());
2. next方法传入参数
next('BBB')传入的参数作为上一个next方法的返回值
function * gen(){
let B = yield '111'
console.log(B);
let C = yield '222'
console.log(C);
let D =yield '333'
console.log(D);
}
let iterator = gen()
console.log(iterator.next());
console.log(iterator.next('BBB'));
console.log(iterator.next('CCC'));
console.log(iterator.next('DDD'));