Don't Make This Mistake in JavaScript - Async Operations

preview_player
Показать описание
When you should use forEach vs for of in async operations.

#softwareengineering #javascript #shorts

Music
Creative Commons / Attribution 3.0 Unported License (CC BY 3.0)
Рекомендации по теме
Комментарии
Автор

🚀 Exclusive DSA Course Vid - Click on Channel Page! 🚀

AlgoJS
Автор

Amazing. I have alot of use cases for this and i remember struggling to perform something similar. Much appreciated. Please keep these videos coming

al-ftng
Автор

Or just use map and an await Promise.all() so you do all of them concurrently instead of sequentially if there isn’t any order requirement to your call.

bob_kazamakis
Автор

liking your videos - keep em coming...

markemerson
Автор

I feel like for each is rarely a better solution than a regular for loop.

suspendedresolution
Автор

I prefer to push the prmises onto an array and use Promise.all or Promise.allSettled outside the loop.

davidgillies
Автор

Why would you put async when in the end you will not leverage async mode?

MrYevelnad
Автор

async processes are intended to be processed concurrently. i cant think of a single situation where that code is desirable.

닐리아담
Автор

Even better to use an await promise.all to start the API requests asap.

kris_lawson
Автор

Oh that's why my forEach didn't work, that's why I resorted to bluebird 😅

whmZ
Автор

Show example with parallels async call but with limited requests at the same time to prevent rate limit or 429 error..
Normally I combine while loop with promise.all and splice and map.. but is not better solution because make groups os request at same time and wait all requests of each group to start next group…

tiagocunhafernandes
Автор

Gr8 content, What theme and font is this?

Matkotech
Автор

Faced this error. Took an 5 hr to understand whats happening.... It was

nknapsterr
Автор

Better do not use it exhaustingly as it blocks the event loop…

danielgruner
Автор

I stopped using for each all together because of this behavior. For of all the way 😊

Stoney_Eagle
Автор

The explanation was not right about why it works

umm_iter
Автор

I mean why though? Like why send a request for each item... I feel like if you have to do that you're doing something wrong from the beginning.

ShadowVipers
Автор

There is a difference being functional vs being async.

ManvendraSK
Автор

Make async run like it's sync, and it's fixed!?

waynes
Автор

Don't worry i won't make the mistake of doing js