Maybe you just learned how to code in javascript, but you are struggling to understand how promises work, why to use async/await or what microtasks and macrotasks are? This course is for you!
What is the output order of simple synchronous code?
How does setTimeout affect execution order?
How do promises affect the event loop? Let's say we make a successful call to some API in the cloud. This is typically asynchronous. In what order will this code be executed?
Which comes first: microtasks or macrotasks (a.k.a. tasks)?
How are multiple .then() callbacks ordered?
What happens with nested setTimeout calls?
How do promises inside setTimeout behave?
How does setTimeout inside a promise behave?
How does async/await affect execution order?
What happens with multiple awaits?
How does chaining .then() affect order?
How are errors in promises handled?
How does process.nextTick fit in the event loop?
How does queueMicrotask compare to Promise and setTimeout?
How does setImmediate fit in the event loop?
How are multiple microtasks ordered?
What is the order of non-awaited functions with awaited functions inside of them?
What happens if you await the first async function (the promise) and not the other one?
What if the first awaited function has a long running fetch inside of it?
What if the first not-awaited function has a long running fetch inside of it and you await only the second?
How are errors handled in when not awaited?
How are errors handled in when awaited?
What if you want to do many asynchronous operations at once?
What happens in a race between two asynchronous operations?
What if you want to call asynchronous functions in sequence?
What if you want to call asynchronous functions in sequence, with await?
How does an async generator work and how is the program executed?
How does an async generator yield values, what if you await inside the generator? The closure is a bonus ;)
Which one is run first, nextTick or setImmediate?
How does await affect the output of asynchronous functions? Can you tell which console.log writes A and which writes the unfulfilled promise, i.e. [object Promise]?
Same thing again but notice the swap of the await. Can you tell which console.log writes A and which writes the unfulfilled promise, i.e. [object Promise]?
Can you predict the output order? If you can do it right away we know you have succeeded in learning the event loop!
Let's put your skills to the test, solve it one go!