async function logInOrder(urls) {
// 并发读取远程URL
const textPromises = urls.map(async url => {
// const response = await fetch(url);
const response = await setTimeout(() => {console.log(1)}, 2000)
return response;
});
// 按次序输出
for (const textPromise of textPromises) {
console.log(await textPromise);
}
}
logInOrder(['a', 'b']);