function one() { setTimeout(() => { console.log(1111); iterator.next(); }, 1000); } function two() { setTimeout(() => { console.log(2222); iterator.next(); }, 2000); } function three() { setTimeout(() => { console.log(3333); iterator.next(); }, 3000); } function* gen() { yield one(); yield two(); yield three(); } let iterator = gen(); // console.log(iterator.next()); iterator.next();