freeCodeCamp.org on YouTube · Open on YouTube
Core skills: building for the web · Advanced beginner · Lesson 18 of 98 · 2 h 12 min video, then about 7 hours of practice
Asynchronous JavaScript, promises and the event loop
After this you can fetch data with async/await, handle failures, and explain why JavaScript does not block while waiting on the network.
Why it matters
Almost everything interesting in web software waits on something: the network, a database, a file. JavaScript handles waiting with promises and `async`/`await`, scheduled by the event loop. Misunderstanding this produces the most confusing bugs beginners meet: values that are `undefined` because you did not await them, and errors that vanish because nothing caught them. Focus on `fetch`, `async`/`await`, `try`/`catch` around awaited calls, and running independent requests in parallel with `Promise.all`. Trap: mixing `.then()` chains and `await` in the same function. Pick `await`.
How to use this resource
Callbacks, promises, async/await and fetch in one course, in the right order.