javascript
ES9 异步 Generator
简介 就像 Generator 函数返回一个同步遍历器对象一样,异步 Generator 函数,返回一个异步遍历器。 一个简单的例子 async function* gen() { yield 'hello'; yield 'world'; } const genObj = gen(); genObj.next().then(x => console.log(x)); // { value: 'hello', done: false } genObj.next().then(x => console.log(x)); // { value: 'world', done: