JavaScript Tip: Using Promise.all with an async Function

preview_player
Показать описание

Would you like to help keep this channel going?

Tutorials referred to in this video:

For more resources on JavaScript:

#javascript #AllThingsJavaScriptLLC
Рекомендации по теме
Комментарии
Автор

Great video, thanks for recommending that playlist

someoneoutthere
Автор

Perfectly explained. Simple, clear, concise. Thanks so much!

kusholh
Автор

I liked the way how you explained it when using Promise.all or one bye one, It helped me a lot Thanks

simple
Автор

Something to work with, it did not solve my problem but the understanding is good, thanks.

mzamomahaeng
Автор

This is exactly what I need for my project. Javascript is hard when I do it, but simple in your videos.

taumus
Автор

would it not be nice if to use map method and destructure results with Promise.all...in this case the array can be dynamic and flexible..great explanation and good work:-)

miraclesdohappen
Автор

You really explained it perfectly! May I suggest something that is really conflicting in Js asynchronous code...
When you have to perform the same todos, comments & posts inside every iteration of a forEach loop.
How would you suggest to do a Promise.all in that scenario?

yoapps
Автор

I have some doubt I don't know whether this is a silly question to ask.
Somebody, please clear this to me

for example, this is one of the functions in my code

async function ex () {
let i = 1;
while (i >0){
console.log("....No end....");
}
}

Since JS is single-threaded only one task will execute at a time.
How this snippet will execute internally?
I read
All the async tasks are sent to the call back queue.
So is this function also sent to the call back queue? (Since I wrap it in an async), or it won't.




Q2. NodeJS

I have another doubt also
In node js, I read that all heavy jobs are sent to the libuv instead of v8.
so libuv create a separate thread pool for executing those tasks.
In that case, let's say libuv created four threads and let this function execute in one thread. Since it is an infinite loop that one thread will get blocked.
Then the remaining tasks after that function will execute or not?

varaprasadreddy