We can use the new for...await...of expression to iterate and await each of the promises returned by an asynchronous iterator:
async function func() { for await (const x of g1()) { console.log(x); } }