JavaScript Under The Hood [3} - Asynchronous JavaScript, Task Queue & Event Loop

  Рет қаралды 59,486

Traversy Media

Traversy Media

Күн бұрын

In this video, we will look at how JavaScript does Asynchronous operations and how the task queue and event loop works.
Event Loop & Microtask Queue Article:
towardsdev.com/event-loop-in-...
💻 My Courses & More
traversymedia.com
💖 Show Support
Patreon: / traversymedia
PayPal: paypal.me/traversymedia
👇 Follow Me On Social Media:
Twitter: / traversymedia
Instagram: / traversymedia
Linkedin: / bradtraversy
Timestamps:
0:00 - Intro
1:00 - Core JS Refresh
1:30 - Blocking Operations
2:05 - Blocking vs Non-Blocking Example
4:06 - Browser Web APIs
6:20 - setTimeout Example
7:47 - Task Queue & Event Loop
10:53 - Promises & Microtask Queue

Пікірлер: 61
@easywebdev1021
@easywebdev1021 Жыл бұрын
This series is best for revising our Js concepts. Thanks Brad, learned a lot from you 💯
@whome4860
@whome4860 Жыл бұрын
Hello Brad! I'm a junior developer from South Korea and i've been watching your video for about 2 years. ☺️ 2 years ago I started to teach my self computer languages and how to build web app with your contents. They were my best teachers really. Thank you so much for the amazing videos. ‼️ I want you to know there is at least one huge fan of you in Korea 😆
@simple8810
@simple8810 Жыл бұрын
great😁
@rogut8
@rogut8 Жыл бұрын
Beautiful visual interpretation of call stack, web APIs and event loop. Well done Brad. Thank you
@ensar8177
@ensar8177 Жыл бұрын
Under The Hood series is really something. Thanks.
@MgelikaXevi
@MgelikaXevi 8 ай бұрын
great series!
@nikitaalekseev991
@nikitaalekseev991 Жыл бұрын
This is Great series! And Brad, you’re actually an awesome diagram creator!
@patolorde
@patolorde 6 ай бұрын
Except its not his diagram
@nikitaalekseev991
@nikitaalekseev991 6 ай бұрын
@@patolorde Oh, important note.
@hamidakbari3305
@hamidakbari3305 Жыл бұрын
respect. thank you for your hard work and your great channel.
@mdshohidurrahman1121
@mdshohidurrahman1121 Жыл бұрын
Thanks for crystal clear explanations.
@ibadshaikh2215
@ibadshaikh2215 Жыл бұрын
Such a refreshing tutorial 💯
@muhammadidrees6650
@muhammadidrees6650 Жыл бұрын
Thanks buddy for great work your are doing, it is gonna help a lot of people for sure :)
@arielro85
@arielro85 Жыл бұрын
Thanks Brad!! Keep Rocking it!
@AlexSenichek
@AlexSenichek Жыл бұрын
Thanks a lot. Really helpful. Great explanation.
@muhammadhamzaawan4504
@muhammadhamzaawan4504 Жыл бұрын
Perfect explanation brad.
@ttufox
@ttufox Жыл бұрын
Great content as always
@NNNedlog
@NNNedlog Жыл бұрын
I've been looking forward to this
@aeronwolfe7072
@aeronwolfe7072 Жыл бұрын
Great series!!!!
@AozenDreyar
@AozenDreyar Жыл бұрын
thank you this serie helped so so much ^^
@rabihg1845
@rabihg1845 Жыл бұрын
Thanks a lot, I would like to see a series about React under the hood in details and how the code is executed, it will be very interesting since nobody did it before
@Naldjei3396
@Naldjei3396 10 ай бұрын
wow! really awesome content! Thanks from Brazil!
@jz1607
@jz1607 Жыл бұрын
Arrive at minute 10:50 and was like WTH he did not explain promises. Then few seconds later you started talking about it :) That's what I was looking for, thanks a lot
@TheCodeAngle
@TheCodeAngle Жыл бұрын
Awesome stuff!!!
@babayaga6172
@babayaga6172 Жыл бұрын
Very informative Make whole series on DSA in JavaScript there are playlist whi cover these topics in c++ but we need JavaScript
@noureldin5611
@noureldin5611 Жыл бұрын
Great video thanks
@thabataalmeida5403
@thabataalmeida5403 Жыл бұрын
great, I need this content
@seddeknadhem5638
@seddeknadhem5638 Жыл бұрын
Thank you my friend.
@_dinhvankhoi
@_dinhvankhoi 8 ай бұрын
does the use of promise , async awaitt , be queued in the callback quere ? , or just Promise , while Async is essentially Promise ?
@ITStars
@ITStars Жыл бұрын
great content , thanks alot
@lifeisbeautifu1
@lifeisbeautifu1 Жыл бұрын
Thank you❤
@ahmed-osama2022
@ahmed-osama2022 11 күн бұрын
Thanks a lot 😊
@nark4837
@nark4837 7 ай бұрын
This is what always confused me, the fact everyone said that asynchrony does not require multiple threads, etc, but what confused me was how the JavaScript engine was executing `fetch`, `setTimeout`, etc at the same time as the code, on a single-thread, but the fact is, the JavaScript engine is only executing one thing, the other things are being executed by the browser APIs (on a different thread!) and then the callback is simply pushed onto the call-stack by the browser back to JavaScript. Therefore, the I/O operations, etc are being executed on different threads, or simply just using another concurrency primitive by the browser at the fundamental level. Is my intuition therefore right that if you have an asynchronous function that does not execute any code using the underlying asynchronous browser APIs, whether it be directly or indirectly through another asynchronous function, will behave synchronously?
@igorr4682
@igorr4682 Жыл бұрын
I would add Micro Task Queue to your diagram to make it complete for example when you user fetch and set time out together.
@kasper369
@kasper369 Жыл бұрын
Can you create an updated video on service workers and web workers? Love your content plz keep the vid coming.
@_Iokanaan_Marusidze_
@_Iokanaan_Marusidze_ Жыл бұрын
Thanks 👍
@tomich20
@tomich20 Жыл бұрын
great explanation. I would like to know why i write down async/await in my functions
@ivanmilenkovic203
@ivanmilenkovic203 Жыл бұрын
Do they ask these kind of things in technical interviews? In any case, thanks a lot Brad :)
@Winter_Wyvern1
@Winter_Wyvern1 Жыл бұрын
I hope u also mention Job queue or the Promise queue has higher priority over the Callback queueu
@HabtamuDesalegn
@HabtamuDesalegn Жыл бұрын
Thank you for sharing useful concepts. please detail (continuous from last video) on NestJS?
@mikefenn2451
@mikefenn2451 Жыл бұрын
I love you Brad…
@BusinessWolf1
@BusinessWolf1 Жыл бұрын
First of all, thank you for the series. Secondly, look at the title. [3}
@danielilievski7144
@danielilievski7144 Ай бұрын
Developers write only open square bracket and expect the IDE to close it for them
@BijanProgrammer
@BijanProgrammer Жыл бұрын
Title of the video has a typo: [3} Great series BTW.
@universecode1101
@universecode1101 Жыл бұрын
I remember a project with setTimeout and Promise ... It was a nightmare, so learn these concepts thoroughly. Any news about your course, Brad?
@jww0007
@jww0007 Жыл бұрын
yo dude I see you on every coding channel
@akxdev
@akxdev Жыл бұрын
You used setTimeout in production?
@javascriptes
@javascriptes Жыл бұрын
@@jww0007 LOL
@markbarlescu1853
@markbarlescu1853 Жыл бұрын
Please add to this playlist , how js engine handles errors
@serychristianrenaud
@serychristianrenaud Жыл бұрын
thank
@jnsjknn
@jnsjknn Жыл бұрын
Are callbacks placed in the task queue immediately when something like setTimeout executes or only after the timeout? If the former, how does the task queue handle the delay before calling the callback? If the latter, how do the web APIs handle the delay?
@nicolaebalica-oncica8896
@nicolaebalica-oncica8896 3 ай бұрын
Very good question, I would also like to know the answer to this, but after 1 year, I don't think Brad will reply :D
@sriramiyer9840
@sriramiyer9840 Жыл бұрын
Could you please make a video on the prototype chain system in javascript too?
@66abady
@66abady Жыл бұрын
give us part 4 already :)
@uploadvoice
@uploadvoice 4 ай бұрын
I am not sure if the callbacks, put in the task queue are executed in a FIFO mode, imagine 2 setTimeouts, where first has bigger timeout …
@trevorbuchanan5962
@trevorbuchanan5962 Жыл бұрын
It's worth noting that there's no task queue in node's event loop. It utilizes libuv's event loop, which, best I can tell, uses a combination of a static order (timers are called first for example), and some internal logic.
@chandramohannegi
@chandramohannegi Жыл бұрын
🙂
@marcusarcher4
@marcusarcher4 Жыл бұрын
You used wrong brackets in the title
@gerardlucas6402
@gerardlucas6402 Жыл бұрын
First view
@TheCodeDealer
@TheCodeDealer Жыл бұрын
First
JavaScript Under The Hood [4] - Memory Storage
12:58
Traversy Media
Рет қаралды 42 М.
JavaScript Under The Hood [1] - Thread & Call Stack
9:05
Traversy Media
Рет қаралды 115 М.
Разбираемся в очередях event loop'а JavaScript
16:50
JavaScript Event Loop: How it Works and Why it Matters in 5 Minutes
7:20
Function Iterators might just change the way we write loops in Go
11:35
What is the JavaScript event loop really all about - Java Brains
8:26
Looking Under the Hood of JavaScript
6:34
ThePrimeagen
Рет қаралды 172 М.
JavaScript Under The Hood [2] - Execution Context
14:28
Traversy Media
Рет қаралды 74 М.
Самые крутые шпионские гаджеты
0:48
veloloh
Рет қаралды 2,1 МЛН
Ох и ПАЛАС! Как я полетал на фанере с ONEPLUS 12R
15:04