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

preview_player
Показать описание
Most Asked JavaScript Interview Questions | SetTimeout & EventLoop | JS Interview Series | Newton School

Let's start building project for practice.

#CSS #HTML #webdevelopment #newtonschool

Subscribe | Like | Comment
------------------------------------------------------------------------------------------------------------------------
Newton school is an online Edtech company providing the highest-rated FULL STACK DEVELOPMENT PROGRAM for professionals, graduates, and women.

NEWTON SCHOOL is your gateway to a high-paying tech career in 6 months with Zero fees till placement, transforming you into a rockstar full-stack developer earning 5-40 Lakh per annum salary. Newton School’s students are already working in more than 150+ top Indian companies, including Zomato, Unacademy, #Deloitte , #Nutanix , etc.

To watch more videos on programming, Data Structures, Android Development, Data Science, C++, Java, React, subscribe to our channel.

Subscribe | Like | Comment

Follow Newton School on
------------------------------------------------------------------------------------------------------------------------
Connect with me :

To stay updated with my youtube videos & quality content for web development -

#PracticeProject #Project #Highlight
Рекомендации по теме
Комментарии
Автор

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.

adityagautam
Автор

worst incomplete poor explanation of event loop and bro toda normal raho aur dialogue toda kam kiya karo

RajYadav-yhvv
Автор

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 👍

parth
Автор

another way to get desired result is to - change var to let it will print 0, 1, 2

BhaveshBarskar
Автор

Thanks for this.we want more questions like this

ambupadamuduli
Автор

for(var i=0; i<3; i++){
setTimeout(function(){
console.log(i);
}(), 1000+i)

}

jagadishprasad
Автор

two times i got this function that fucked up my interview

mohakmaheshwari
Автор

not working, throwing error while executing online jscompiler

jagadishprasad
Автор

Why do you use English title and then speak another language in the video?

bromptonhorsing
Автор

kya smjhaya bhai tune??? kuch smjh nhi ayaa

PURRAHARAAMI
Автор

Use let instead of var.. output will be 0, 1, 2

techupdate
Автор

sir var ki jgh let krne pr 012 answer kiyo a rha he

RohitSharma-iqne
Автор

bhai interviewer kya sochega usse chodo wo btao jo tum soch rha hao, uske dimaag mai rhen do ki wo kya puchega

sachinsharma
Автор

Bhai kya bolna chaha raa hai? Jaldi Bol Kal Subah Panvel Nikalna Hai...

prasandeep
Автор

Galat maat batao bhai its discouraging!!

amarnathmishra