<script>
/**
* 生成器函数,带参数
*/
function * gun(arg){
console.log("***",arg); //*** AAA
let one = yield "111";
console.log("***",one); //*** CCC
let two = yield "222";
console.log("***",two); //*** DDD
let three = yield "333";
console.log("***",three); //*** EEE
}
let iterator = gun("AAA");
let B = iterator.next("BBB"); //AAA
console.log("fff",B); //fff {value: "111", done: false}
let C = iterator.next("CCC"); //CCC
console.log("fff",C); //fff {value: "222", done: false}
let D = iterator.next("DDD"); //DDD
console.log("fff",D); //fff {value: "333", done: false}
let E = iterator.next("EEE"); //EEE
console.log("fff",E);
</script>