Understanding JavaScript Promises in ForEach, Map, and Reduce Loops
In this lesson, we'll take a look at how promises work when we try to await them inside newer callback-based loops, like forEach, map, and reduce. We'll examine how we can use reduce to execute our promises sequentially. And, we'll see a quick way to await for all our promises to execute in a non-sequential order using map. 👍 If You Enjoy This Video, Consider Hitting The Like Button! 🔓 Learn How To Implement Authentication in 15 Minutes: https://youtu.be/hs678tiZTuo 🥁 Subscribe To Stay Notified For New Lessons: https://www.youtube.com/adocasts?sub_confirmation=1 📕 View on Adocasts: https://adocasts.com/lessons/how-to-create-a-password-reset-flow-in-nodejs-with-adonisjs 📚 Chapters: 00:00 - Intro 00:53 - What Doesn't Wait for Await? 02:18 - Map Loops & Promise.all 04:30 - Map Will Not Be Sequential 05:50 - Sequential Loops With Reduce 07:20 - Showing Examples Without Logs 09:10 - Traditional Loop Behavior (for, while, do while) 10:50 - Key Takeaways 11:19 - Outro ----------------------------------------- 🕸️ Website: https://adocasts.com 🐘 Mastodon: https://fosstodon.org/@adocasts 🐦 Twitter: https://twitter.com/adocasts 👍 GitHub: https://github.com/adocasts
Download
0 formatsNo download links available.