Attempting to use Async / Await with forEach is a bad idea. In this advance async/await Javascript tutorial, I’ll show you why. You will learn how for, for…of, Promise.all(), and reduce all provide alternative solutions that are better than forEach.
π© Subscribe β
π This tutorial is part of an Advanced Javascript Concepts tutorial series playlist:
Async Await with forEach is BAD! | Advanced Async/Await Javascript Tutorial
(00:00) Intro
(00:05) Welcome and Intro
(00:22) forEach – What’s it good for?
(02:34) Async fetch request example
(03:51) forEach with Async Await is BAD
(07:33) Alternative #1: traditional for loop
(09:39) Alternative #2: for…of loop
(10:39) Alternative #3: Promise.all with map
(14:01) Alternative #4: A different reduce
π References:
MDN forEach:
MDN for…of:
MDN PromiseAll:
MDN reduce:
β
Follow Me:
Twitter:
LinkedIn:
Blog:
Reddit:
Was this tutorial about why forEach is not for use with Async/Await in Javascript helpful? If so, please share. Let me know your thoughts in the comments.
#foreach #async #await