Most Asked JavaScript Interview Questions | SetTimeout & EventLoop | JS Interview Series

  Рет қаралды 19,770

Career With Gaurav

Career With Gaurav

Күн бұрын

Пікірлер: 36
@adityagautam1217
@adityagautam1217 Жыл бұрын
Those who are trying to understand this might help: the for loop will complete all iterations before any of the setTimeout functions are executed because setTimeout is an asynchronous function . As a result, the value logged for i in all three iterations will be 3. if we change var to let, output will be 0,1,2 because in case of let a new block scope is created for each iteration of the loop. This means that each iteration of the loop will have its own separate lexical environment and its own distinct value whereas in case of var, it does not create a new block scope, there is only one i variable shared across all iterations of the loop as var is function scoped.
@shagunjaiswal3403
@shagunjaiswal3403 11 ай бұрын
video se jada acha tummhare code ne samjha diya
@RajYadav-yh7vv
@RajYadav-yh7vv 2 жыл бұрын
worst incomplete poor explanation of event loop and bro toda normal raho aur dialogue toda kam kiya karo
@parth1450
@parth1450 2 жыл бұрын
I am still waiting for your exact explanation.. Bhai tho slow details me bana do video..tho acha hoga .. Ye video kab shuru hoke khatm hua pata hi nai chala.. This is genuine feedback don't take it otherwise 👍
@careerwithgaurav
@careerwithgaurav 2 жыл бұрын
Hi, Sure have noted dow will make video on this again soon in JS series for beginners which is currently in progress.
@buggplayer2301
@buggplayer2301 Жыл бұрын
true and lesss content and more promotion
@animeshdey6289
@animeshdey6289 2 жыл бұрын
Callstack works on LIFO not FIFO
@BhaveshBarskar
@BhaveshBarskar Жыл бұрын
another way to get desired result is to - change var to let it will print 0,1,2
@jagadishprasad4142
@jagadishprasad4142 Жыл бұрын
not working, throwing error while executing online jscompiler
@techupdate03
@techupdate03 2 жыл бұрын
Use let instead of var.. output will be 0,1,2
@FreeSkypeGenerator1
@FreeSkypeGenerator1 2 жыл бұрын
thanks for the pointer
@mohakmaheshwari8756
@mohakmaheshwari8756 2 жыл бұрын
interviewers don't let you change it two let and const , self calling function is the only way
@jagadishprasad4142
@jagadishprasad4142 Жыл бұрын
for(var i=0; i
@bromptonhorsing8597
@bromptonhorsing8597 2 жыл бұрын
Why do you use English title and then speak another language in the video?
@mohakmaheshwari8756
@mohakmaheshwari8756 2 жыл бұрын
two times i got this function that fucked up my interview
@fatimaiqra2169
@fatimaiqra2169 4 ай бұрын
thanks
@PURRAHARAAMI
@PURRAHARAAMI 2 жыл бұрын
kya smjhaya bhai tune??? kuch smjh nhi ayaa
@ambupadamuduli3794
@ambupadamuduli3794 3 жыл бұрын
Thanks for this.we want more questions like this
@misterl8129
@misterl8129 3 жыл бұрын
damn, dont understand the language
@imkir4n
@imkir4n Жыл бұрын
u earned my sub,thank u
@ArnavSingh-im5bj
@ArnavSingh-im5bj 3 ай бұрын
Or you can use let
@RohitSharma-iq8ne
@RohitSharma-iq8ne 3 жыл бұрын
sir var ki jgh let krne pr 012 answer kiyo a rha he
@BhaveshBarskar
@BhaveshBarskar Жыл бұрын
because "let" keyword is blocked scoped, so for every iteration value of new copy of i is passed to closure function i.e setTimeout().
@ravikumarchaudhari1606
@ravikumarchaudhari1606 2 жыл бұрын
thank you for this osm video
@sachinsharma1755
@sachinsharma1755 2 жыл бұрын
bhai interviewer kya sochega usse chodo wo btao jo tum soch rha hao, uske dimaag mai rhen do ki wo kya puchega
@parth1450
@parth1450 2 жыл бұрын
😂😂
@girishpandey2936
@girishpandey2936 2 жыл бұрын
thanks sir
@codewithkaran8860
@codewithkaran8860 2 жыл бұрын
1 question answer is 333
@prasandeep6999
@prasandeep6999 Жыл бұрын
Bhai kya bolna chaha raa hai? Jaldi Bol Kal Subah Panvel Nikalna Hai...
@petvinnie
@petvinnie 2 жыл бұрын
3
@amarnathmishra8697
@amarnathmishra8697 Жыл бұрын
Galat maat batao bhai its discouraging!!
@mayankchourasiya7737
@mayankchourasiya7737 25 күн бұрын
bhai channel bnd kr de time waste mt kr humara
@adityagautam1217
@adityagautam1217 Жыл бұрын
not a good explaination
@jaysinghsolanki7094
@jaysinghsolanki7094 6 ай бұрын
Abe mere bhai explain toh kya bakwaas youtuber hai
@bhaveshgupta7736
@bhaveshgupta7736 Жыл бұрын
10min waste kr die mere
@patilrahul515
@patilrahul515 Жыл бұрын
Rude..
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
Top 50 JavaScript Interview Questions and Answers
1:34:02
Sangam Mukherjee
Рет қаралды 11 М.
10 JavaScript Interview Questions You HAVE TO KNOW
13:41
James Q Quick
Рет қаралды 84 М.
The Event Loop in JavaScript in Hindi | You are expert if you know this
13:06
JavaScript Event Loop: How it Works and Why it Matters in 5 Minutes
7:20
Top 100 JavaScript Interview Questions and Answers
3:00:42
Interview Happy
Рет қаралды 363 М.