Three strategies for the JavaScript event loop - Brain Bytes [Java Brains]

  Рет қаралды 26,407

Java Brains

Java Brains

Күн бұрын

Learn about 3 strategies you can use in your JavaScript code to work with the event loop and the single application thread in JavaScript
Java Brains website: javabrains.io
#JavaBrains #BrainBytes #HowTo #JavaScript #Tutorial #Concept

Пікірлер: 45
@enfieldli9296
@enfieldli9296 2 жыл бұрын
"The callback function gets put to the back of event queue". That's so refreshing!
@sandeepsundaram5577
@sandeepsundaram5577 4 жыл бұрын
Happy Teachers Day !! One of the best teacher's !!!
@romanazeem3098
@romanazeem3098 4 жыл бұрын
Best and the most hidden topic using JavaScript. Great Content
@mohammedshirhaan9492
@mohammedshirhaan9492 Жыл бұрын
There are so many famous tutorials out there that teach wrong things. Your tutorials are the real thing ♥️. Please create a complete Javascript course.
@CVenture
@CVenture 4 жыл бұрын
Great .. Can you pls explain the differences between async await, promise and call backs? It confuses all the time..
@ranikontham5573
@ranikontham5573 Жыл бұрын
If we call a function inside another function then it is call called back. Promises are used to handle call back hells they have 2 parameters resolve, reject. To handle resolve we need to use .then to handle reject we need to use .catch To handle the promise chaining we will use async/await We need to use these async/await jointly for example async function test(){ let data1=await func1(); let data2=await func2(); } async > promise > callback I hope you got some idea now
@CVenture
@CVenture Жыл бұрын
@@ranikontham5573 Thanks for replying after 2 years tho. Appreciate your effort.
@d3vilscry666
@d3vilscry666 9 ай бұрын
@@CVenture Do you understand it now? lol
@techiesrikanth2447
@techiesrikanth2447 4 жыл бұрын
Happy Teacher's Day Koushik !!. Thanks for your Amazing Content.
@MustafaAli-xj6lq
@MustafaAli-xj6lq 2 жыл бұрын
Best and most simple video so far
@khalidben9940
@khalidben9940 2 жыл бұрын
Great as usual.I learned a lot of java concept from you now I am learning Javascript advanced staff from you.I am grateful.
@4t196
@4t196 2 жыл бұрын
You explaine very well...
@smartydude2157
@smartydude2157 4 жыл бұрын
Thank you so much for such informative video 😊.. Please make playlist of Data structure and Algorithms using Javascript will feel more thankful. Because there is no such playlist to learn Algorithm using Javascript.Thank you 😊
@vivekmishra5876
@vivekmishra5876 4 жыл бұрын
Great teacher always simplyfies the explanation like you
@sreenathmca
@sreenathmca 4 жыл бұрын
As usual you are great in explaining complex things in simple way...
@yashpandey9550
@yashpandey9550 4 жыл бұрын
Really liked the introduction to web workers. Quality content as always 🙏
@vsowill
@vsowill 2 жыл бұрын
Man this is gold!
@sundaramjha1776
@sundaramjha1776 4 жыл бұрын
Really Awesome, i always recommend ur channel to other people.
@dipper0yawn
@dipper0yawn 3 жыл бұрын
I really like your didactic approach.
@RAJATTHEPAGAL
@RAJATTHEPAGAL 4 жыл бұрын
setTimeout(fn, 0) and setNextTick are effectively same right, appendig the function to end of pending function callback queue 🤔. Although for anyone reading there is a setImmediate 😐 which actually happens to place the function call for the next tick and not the end if event loop. 😌 Small nuances of nodejs api
@bourairabdullah1287
@bourairabdullah1287 4 жыл бұрын
Please create tutorials for Docker and Kubernates, this topic is widely used and new !
@deadchannel-x2m
@deadchannel-x2m 4 жыл бұрын
So well-explained! Thank you!
@KDOERAK
@KDOERAK 3 жыл бұрын
great examples; I learned a lot. Thx!
@ashishchourasia2830
@ashishchourasia2830 3 жыл бұрын
Great explanation, but I have some doubts: In strategy 1, why can't we just call the lessimportantWork() after the moreImportantWork()? why to use setTimeout altogether?
@garbagemail9089
@garbagemail9089 3 жыл бұрын
hmm....good question AMC
@elmersbalm5219
@elmersbalm5219 3 жыл бұрын
Js works in a loop. A good candidate would be user interaction and screen update functions. Not terribly important but needs to be small, quick and out of the way when* needed. Let’s say you’re updating a cart to a busy server, not an intensive process but can be slow. You still need to interact with the user and that all happens in the event loop. * when the loop magic allows time for them
@FahadKhan-qj3ej
@FahadKhan-qj3ej 2 жыл бұрын
Thank you so much.
@praveenj3112
@praveenj3112 4 жыл бұрын
Thank you Koushik for this great content
@enki1939
@enki1939 Жыл бұрын
why do we not just move the lessImportantFunction after the moreImportantFunction? Feels like that would be more of an intuitive way that doing the setTimeout(fn,0)?
@praveen27100
@praveen27100 3 жыл бұрын
It's Great!!! Thanks a lot . You are amazing...
@smartguy3k
@smartguy3k 3 жыл бұрын
Awesome!!! Thanks.
@chieeyeoh6204
@chieeyeoh6204 4 жыл бұрын
9:26 when you explain strategy 2 function processArray(bigArray, start) I think it will only execute once, because right after the forloop, start get increased by BATCH_SIZE while BATCH_SIZE remain the same the whole time
@ShubhamKundu_
@ShubhamKundu_ 3 жыл бұрын
He told that there is a bug in the code, the condition should have been "i < start + BATCH_SIZE" instead of "i < BATCH_SIZE"
@vivekkoul4428
@vivekkoul4428 6 ай бұрын
How it will be start + batch size? Batch size is the size of the array and loop can't exceed batch size.
@ranjeetthorat1318
@ranjeetthorat1318 3 жыл бұрын
Use case one. just reorder function call .no need for settineout
@AnandKumar-ro1yd
@AnandKumar-ro1yd 4 жыл бұрын
Sir, have you created multithreading and concurrency tutorial? Please create tutorial in this. These concepts are hard to understand
@pragyan394
@pragyan394 3 жыл бұрын
I always used setTimeout with 0ms as the time, but only now do I properly understand what it's actually doing
@rushabhmandvekar4411
@rushabhmandvekar4411 3 жыл бұрын
Hello Sir, Please make one series on Nashorn JavaScript. The amount of contents on internet are very very less. Please address this. Thank You..!!
@shubhampatel7870
@shubhampatel7870 4 жыл бұрын
Hi Koushik, can web workers communicate amongst themselves? webWorker1 and webWorker2 for example
@pranab1989
@pranab1989 3 жыл бұрын
Can you please tell us what software you are using to edit video.
@vivekkoul4428
@vivekkoul4428 6 ай бұрын
Can anybody tell me pls what is the bug in the 2nd method?
@NicDHa
@NicDHa 3 жыл бұрын
great!
@RafikBianconero
@RafikBianconero 3 жыл бұрын
So at the end is Nodejs a similar Java runtime ? since web workers were lunched ? at the end the difference between Java ecosystem and Javascript is only the fact that JS is a loosly typed, flexible language ?! It seems like there is a mimication or recreation or lets say highjacking of the Java ecosystem and a community revolution against Oracle passed supremacy, a community revolution supported by Google through v8 engin... ? is it right ?
@vivekkoul4428
@vivekkoul4428 6 ай бұрын
Is event loop concept also in javascript?
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 36 МЛН
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 199 МЛН
Minecraft Creeper Family is back! #minecraft #funny #memes
00:26
Как мы играем в игры 😂
00:20
МЯТНАЯ ФАНТА
Рет қаралды 1,6 МЛН
What is the JavaScript event loop really all about - Java Brains
8:26
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
npm prank gone wrong.
11:03
Java Brains
Рет қаралды 11 М.
The Async Await Episode I Promised
12:04
Fireship
Рет қаралды 1,1 МЛН
What are microservices really all about? - Microservices Basics Tutorial
15:12
What is JWT? JSON Web Tokens Explained (Java Brains)
14:53
Java Brains
Рет қаралды 1 МЛН
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 36 МЛН