yield和generaotor
2021-09-07 本文已影响0人
9月的甜橙子
function* generatorOne(){
yield ['a','b','c'];
}
function* generatorTwo(){
yield* ['a','b','c'];
}
const one = generatorOne();
const two = generatorTwo();
one.next().value; // ['a','b','c']
two.next().value; // a