JavaScript Tip: Using Promise.all with an async Function

  Рет қаралды 10,904

All Things JavaScript, LLC

All Things JavaScript, LLC

Күн бұрын

Пікірлер: 27
@taumus1
@taumus1 3 жыл бұрын
This is exactly what I need for my project. Javascript is hard when I do it, but simple in your videos.
@AllThingsJavaScript
@AllThingsJavaScript 3 жыл бұрын
Great to hear!
@michaelbeckett8196
@michaelbeckett8196 3 жыл бұрын
i guess I'm kind of off topic but do anybody know a good place to watch newly released series online?
@darianahmed1401
@darianahmed1401 3 жыл бұрын
@Michael Beckett Flixportal :P
@michaelbeckett8196
@michaelbeckett8196 3 жыл бұрын
@Darian Ahmed Thanks, I went there and it seems like they got a lot of movies there :) I really appreciate it !
@darianahmed1401
@darianahmed1401 3 жыл бұрын
@Michael Beckett no problem xD
@kusholh7095
@kusholh7095 2 жыл бұрын
Perfectly explained. Simple, clear, concise. Thanks so much!
@AllThingsJavaScript
@AllThingsJavaScript 2 жыл бұрын
Glad it was helpful!
@themysteryman-e2j
@themysteryman-e2j 3 жыл бұрын
Great tutorial. Saved me lot of time
@AllThingsJavaScript
@AllThingsJavaScript 3 жыл бұрын
Great to hear!
@someoneoutthere1866
@someoneoutthere1866 3 жыл бұрын
Great video, thanks for recommending that playlist
@zhasan66
@zhasan66 3 жыл бұрын
Really a wonderful video tutorial.
@simple8810
@simple8810 3 жыл бұрын
I liked the way how you explained it when using Promise.all or one bye one,It helped me a lot Thanks
@AllThingsJavaScript
@AllThingsJavaScript 3 жыл бұрын
You are welcome!
@boonchanal
@boonchanal 10 ай бұрын
Thanks
@mzamomahaeng268
@mzamomahaeng268 3 жыл бұрын
Something to work with, it did not solve my problem but the understanding is good , thanks.
@miraclesdohappen2352
@miraclesdohappen2352 3 жыл бұрын
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:-)
@themysteryman-e2j
@themysteryman-e2j 3 жыл бұрын
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?
@AllThingsJavaScript
@AllThingsJavaScript 3 жыл бұрын
The async function is a pattern for working with asynchronous tasks. It doesn't force plain JavaScript code to be asynchronous. All JavaScript is executed single threaded. Those things that are asynchronous are timers, events, fetch etc. Callbacks from those are added to the callback queue and handled by the event loop. As per my understanding libuv handles timers, non-blocking networking, files system access etc. So once again, regular JavaScript is handled by the JavaScript engine which is single threaded.
@themysteryman-e2j
@themysteryman-e2j 3 жыл бұрын
@@AllThingsJavaScript Thank you so so much for clarifying me.
@haroondeveloper
@haroondeveloper Жыл бұрын
done sir
@AllThingsJavaScript
@AllThingsJavaScript 3 жыл бұрын
Discount on Asynchronous JavaScript Deep Dive course: www.udemy.com/course/asynchronous-javascript-deep-dive/?couponCode=ATJSNOV20 Playlist on asynchronous JavaScript and promises: kzbin.info/aero/PLTo9PCskHpbHIDnzl8tRYldSCSQaFgAHd
@yoapps137
@yoapps137 3 жыл бұрын
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?
@AllThingsJavaScript
@AllThingsJavaScript 3 жыл бұрын
If you are using forEach, store the promises in an array and then once done with forEach, put the array in Promise.all.
@yoapps137
@yoapps137 3 жыл бұрын
An example would be nice. :-)
@hamidRaven13
@hamidRaven13 Жыл бұрын
thanksssssss😀
@AllThingsJavaScript
@AllThingsJavaScript Жыл бұрын
You're welcome!
Understanding and Using JavaScript Promises
25:19
All Things JavaScript, LLC
Рет қаралды 23 М.
So Cute 🥰
00:17
dednahype
Рет қаралды 68 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 14 МЛН
小丑在游泳池做什么#short #angel #clown
00:13
Super Beauty team
Рет қаралды 44 МЛН
отомстил?
00:56
История одного вокалиста
Рет қаралды 7 МЛН
Просто o async, await. Без циклов и таймеров. JavaScript
15:55
WebDev с нуля. Канал Алекса Лущенко
Рет қаралды 99 М.
Tips For Using Async/Await in JavaScript
16:26
James Q Quick
Рет қаралды 395 М.
Async JavaScript & Callback Functions -- Tutorial for Beginners
24:21
Using a Double Sort on an Array of Objects
12:28
All Things JavaScript, LLC
Рет қаралды 8 М.
Creating JavaScript Promises
19:15
All Things JavaScript, LLC
Рет қаралды 10 М.
Async Await vs. Promises - JavaScript Tutorial for beginners
24:30
So Cute 🥰
00:17
dednahype
Рет қаралды 68 МЛН