Why should you use async/await if you can just use Promise.then() syntax instead? We'll examine two situations where async/await truly excels at asynchronous code. By the end of this video, you will understand why JavaScript developers love async/await and how it improves the readability of your code.
This video lesson is part of the Practical Async/Await course. Check it out! 👇
🎞 Timestamps
00:00 - Confusing order of execution
00:37 - Problem #1: Accessing variable later in the chain
01:35 - Extracting variable to outer scope
02:14 - Nesting promise chain
02:38 - Refactoring to async/await
03:15 - Problem #2: Async function inside if statement
04:10 - Using async/await