Step 6 of 6
Async: the event loop
JavaScript runs one thing at a time. When it waits on the network or a timer, it parks that work and handles other things, coming back when the result is ready. async/await is a nicer way to write that waiting.
Why it matters when you build with AI: Forgotten awaits, unhandled promise rejections and race conditions are some of the most common bugs in AI-generated code.
Quick check
You forgot an await before saving to the database. What happens?
Without await, the next line runs immediately, maybe before the write is done.