Hacker News new | ask | show | jobs
by theprotocol 3283 days ago
Oh. This is interesting. Is the `for await` loop synchronous, or is more like looping through the results of `Promise.all`? With Promise.all, you can make multiple async concurrently and then await the results once all of them are complete.
1 comments

for-await loop behavior is bit complex, but roughly, it's like async await functionality. So, for-await loop wait promise step by step, and if await keyword exists in loop body, wait too. So it's looks like synchronous from inside of async function, but behave as asynchronous promise at outside of async function.