//生成器generator配合yeild来使用
// 生成器生成迭代器每次踢一脚,继续往前走
function* fn(){
yield 1;
yield 2;
}
let it= fn();
console.log(it.next())
console.log(it.next())
console.log(it.next())
//{ value: 1, done: false }
{ value: 2, done: false }
{ value: undefined, done: true }