复制1async function* range(start, end) { 2 for (let i = start; i <= end; i++) { 3 yield Promise.resolve(i); 4 } 5} 6 7(async () => { 8 const gen = range(1, 3); 9 for await (const item of gen) { 10 console.log(item); 11 } 12})();
1async function* range(start, end) { 2 for (let i = start; i <= end; i++) { 3 yield Promise.resolve(i); 4 } 5} 6 7(async () => { 8 const gen = range(1, 3); 9 for await (const item of gen) { 10 console.log(item); 11 } 12})();
本题为“单选题”
题库维护不易,您的支持就是我们最大的动力!