setTimeout + Closures Interview Question 🔥 | Namaste 🙏 JavaScript Ep. 11

preview_player
Показать описание
Check out the most frequently asked (setTimeout + Closures in a loop) hot trending JS Interview question. 🔥This question will strengthen your knowledge and understanding of Closures and will also help you in your frontend/full stack/ web development interview. We will start with an easy JS question and slowly move to the hard and tricky interview question.

If you are giving web developer interviews actively, there are high chances that you might find this question in your frotend developer interview. Candidates have faced this question in their interviews for Amazon, Facebook, Paypal, Microsoft and many other big tech firms.

The only request is to watch this Episode of Namaste JavaScript with full attention. 🙏

Timestamps:
00:00 - Introduction - setTimeout & Closures Interview Question
00:19 - Code Begins - Easy Question
03:12 - How setTimeout actually works in JS
04:45 - Most asked Tricky JS Interview Question
06:58 - Importance of Closures
10:15 - Solution to the problem
12:45 - Extension of the interview question
16:50 - Teaser of the next video
17:11 - Thank you for watching Namaste JavaScript 🙏

Support this video series, NOT BY MONEY, but by sharing it with your friends. 🙏
I'll give my best to come up with great content and everything absolutely for free on YouTube. 😊

If you are active on Social Media,
please give a shoutout to Namaste JavaScript and help me reach more people. 🙏

Cheers,
Akshay Saini

Would love to Stay Connected with you ❤️

#NamasteJS #AkshaySaini
Рекомендации по теме
Комментарии
Автор

"Time, tide and JS wait for none" - Want this on my T-shirt 😀

abhinav
Автор

3 years of coding in JavaScript and now i know that i don't know javascript properly 😂. Thank you bro tune meri aankhe khol di🤩

deepakdesai
Автор

Things learned:
1. setTimeout stores the function in a different place and attached a timer to it, when the timer is finished it rejoins the call stack and executed.
2. Without closure the var reference gives the latest value as it does not retain the original value but rather has the reference so any update in value after timeout will be shown.
3. If we use let/const because they have block scope, every time a new copy of variable is attached, thus this can be done without closure.

AmanMishra-pncq
Автор

This is most literally the most simplified explanation on closure and this question over the internet. As usual just amazing and thanks a ton, man

atif
Автор

Sir, Please make series on React as well. Will be highly appreciated :)

tanyagoel
Автор

Please watch this video with UTMOST ATTENTION. Listen to each line very carefully. 🙏
Also, do let me know will you be able to answer this question in the interview now? ✌🏽

akshaymarch
Автор

Great job Akshay, I am myself a javascript developer and love JavaScript, u really inspiring, doing a grt job not only in educating them but explaining them these tough concepts so that even kindergarten child can understand, really amazed to see your passion . God Bless you.

sushantthakur
Автор

got that answer of setTimout running in loop before you printed on console. Very cool example of closures. Seriously man best playlist on JS on youtube.

Aman-gwro
Автор

Javascript is tricky but your explanation is so crisp and clear that even a non JS developer can understand it.

aijaz
Автор

Your passion to teach is awesome. We can clearly see it in your eyes you want to help others to grow rather than earning money by sharing your knowledge. ❤️

sravankumar-hvlp
Автор

After reading many articles and watching other videos about closures & loops, I finally understand why we experience this behaviour. The key was to understand that the async function stores the reference and not the value! Thank you, and I love your style of teaching.

sofiaborovskaia
Автор

Some tough concepts well handled and it's always so fun to watch as the way you keep the viewers glued to the video. I have never used JS before but now I feel that I should start doing some programs related to it for practice. I never got the idea of craziness of viewers towards this series, now I do realize their excitement for "Namaste JS". Kudos!!

aroundtheglobeSwati
Автор

Interviewer asked me exactly this question, but i didn't know.
But thanks to the knowlege i got from your other videos, i was able to convince them to hire me.
Thank you Akshay, for everything you've done and everything you'll be doing in the future.
World needs more people like you, who not only are successful themselves but also guiding others and making their journey a lot easier.

nikhil
Автор

Now that you spoke of event loop, we need a video on this topic too 😀
Folks, like this comment if you too want a video on event loop.

Thanks!! 🙏

prafulsinghvit
Автор

I am binge watching NAMASTE JAVASCRIPT and look forward to do the same next weekend also. The best JS course in the world right now.

animeshsharma
Автор

I always thought that only C++ template spaghetti has something mind bending to offer, but now I have a purpose to learn JS. Thank you Akshay bhai!

kartikshrivastava
Автор

Bhaiya ye video dekhne k baad jiski job lagegi vo itna kush ni hoga jitna aap thumbnail mein hore 😅. ❤️

shikharjoshi
Автор

I've completed my master's in mechanical enginnering, and after that, I planned to switch my career in the IT industry.
Yesterday, I cracked the first round of interviews for the position of front-end developer.
All the questions on JS were from your videos, and I can bet that the interviewer has also watched your Namaste Javascript series.

farazhusain
Автор

I like the way how you added memes/gif in between... put some smile while we're concentrating to learn concepts. Thank you for making us understanding JS.

ashwini.r.
Автор

You are amazing as always brother . Nobody understands the hard work you have done off screen, referring so many resources and books, making masterpiece videos are also challenging and time consuming. Completed Season 1 play list . switching gear to season 2 .

amarnathmishra