2020-05-23
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await
9000ms 정도 걸린다
async function timeTest() {
await timeoutPromise(3000);
await timeoutPromise(3000);
await timeoutPromise(3000);
}
3000ms 정도 걸린다
async function timeTest() {
const timeoutPromise1 = timeoutPromise(3000);
const timeoutPromise2 = timeoutPromise(3000);
const timeoutPromise3 = timeoutPromise(3000);
await timeoutPromise1;
await timeoutPromise2;
await timeoutPromise3;
}
그간 기계적으로 const response = await timeoutPromise();
처럼 Promise 결과값 할당과 동시에 await 붙였었는데 조심해야겠다.