JavaScript Closures Tutorial (Explained in depth)

JavaScript Closures Tutorial (Explained in depth)

ColorCode

2 года назад

64,767 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

ColorCode
ColorCode - 01.11.2021 16:10

JavaScript closures! 🎉💻

Ответить
Nermeen Ali Abdelhakeem
Nermeen Ali Abdelhakeem - 14.10.2023 23:53

Thank you a lot

Ответить
Alfred Pithu
Alfred Pithu - 11.10.2023 01:54

Man! I am a fan now. Take love from Bangladesh ❤

Ответить
Thomas Winterburn
Thomas Winterburn - 07.10.2023 11:43

Excellent video explains it so well, I did some digging and found why it stays in memory.

So like quantum entanglement theory, the outer function is entangled with the inner functions so, the JavaScript engine uses garbage collection to clean up memory that is no longer reachable.

Because the inner function still has a reference to the outer function's environment, that environment is considered reachable and isn't garbage-collected. This allows the inner function to access variables from the outer function even after it has finished executing.

Ответить
Techlead Cloud Consulting
Techlead Cloud Consulting - 30.09.2023 09:14

You are the best 🎉🎉🎉🎉

Ответить
keyvan salmani
keyvan salmani - 27.09.2023 21:04

همش حسم بهم میگفت ایرانی هستی همینطور قلی گفتنات خخخ تا اینکه این ویدیو رو دیدم مطمئن شدم ایرانی هستی
ایول داری داداش از موش هم بهتری👏❤

Ответить
Itsnobledean
Itsnobledean - 21.09.2023 14:35

I know he has a course he about to come out with. The thing is, I’m not going to stop learning, nor will I go backwards after understanding, and implementing many topics of your videos. I want to learn from you, but I don’t know how long it takes to create these courses. I will say, I’ve been learning JavaScript at an exceptional rate, and waiting on courses will not allow me to move forward with my goals. I’ll be well in to React by the time his course come out and it’ll not even be worth it for me.

Ответить
CarSugar
CarSugar - 15.09.2023 13:15

Bravo! Very nice explanation

Ответить
KalTube
KalTube - 14.09.2023 19:56

Well Done

Ответить
Ghasem Baghban.G
Ghasem Baghban.G - 28.08.2023 16:27

GREAT!

Ответить
basil vj
basil vj - 19.08.2023 18:48

can you explain advanced react hooks like useMemo etc. Btw great presentation

Ответить
YSKORKYS
YSKORKYS - 07.08.2023 22:43

closures are variables and functions that are within the components function.

Ответить
Guliani The Prosecutor
Guliani The Prosecutor - 29.07.2023 18:31

You’re great Sina!!! You’re god sent and put out quality content that clarifies JavaScript concepts that are sometime not very digestible for new developers and aspiring ones.

Ответить
Shaolin
Shaolin - 27.07.2023 08:11

I didn't like the video. Maybe it's just me.

Ответить
Ichirou Takashima
Ichirou Takashima - 26.07.2023 13:39

I know this is a year old video but it is still very helpful. I hate that I'm using closures but I don't know how to explain it.

It's like, watching a video in another language without subtitles. Though you can understand it, you can barely speak it. That's how closures to me are.

Ответить
Kourosh Eidivandi
Kourosh Eidivandi - 17.07.2023 12:27

You are the best! 😍

Ответить
Dhanesh Mane
Dhanesh Mane - 14.07.2023 17:27

perfect

Ответить
Syed Yaseen Shabir Ahamed
Syed Yaseen Shabir Ahamed - 12.07.2023 01:17

This is incredible! Thanks for this!

Ответить
Kannada discover
Kannada discover - 04.07.2023 20:19

This is your teaching is pretty good...keeep continue dude

Ответить
Clash Royale
Clash Royale - 29.06.2023 04:43

excelent video. Your talking is unique

Ответить
Y Am I Still Here?
Y Am I Still Here? - 26.06.2023 22:52

This channel rocks!

Ответить
Alex_Blue
Alex_Blue - 25.06.2023 11:25

Lol I'm here because my explanation of a closure in a recent interview wasn't that great.

Ответить
Paresh B. Patel
Paresh B. Patel - 20.06.2023 00:16

An excellent tutorial on JS Closures. Thanks, Sina.

{2023-06-19}

Ответить
Dasturchi Oka
Dasturchi Oka - 18.06.2023 23:04

Bro is really coding in DevTools

Ответить
Samaneh HG
Samaneh HG - 24.05.2023 03:32

Thanks for your great explanation🙏 can you please have some c++ tutorials too??

Ответить
Maquis American
Maquis American - 23.05.2023 16:09

lmao... if you are new to javascript this tutorial is going to be hard to follow. Good luck.

Ответить
Sanvir Ahmed
Sanvir Ahmed - 30.04.2023 20:10

In your channel, the about section says, 'Coding Tutorials for regular people! 🎉👨🏻‍💻📽 '
but, you are irregular
😃

By the way, I'm a fan of your explanation style. I look forward for your video. 🥰

Ответить
sumon barai
sumon barai - 20.04.2023 20:29

you are a great teacher . thanks for every video that's are provide javascript community. watching from Bangladesh 🇧🇩🇧🇩

Ответить
Nicolai Gomez
Nicolai Gomez - 20.04.2023 02:36

Amazing. About halfway through I figured out....I have been using closures this whole time. Another great example is writing a custom hook to fetch in React. Great stuff. You describe things really well.

Ответить
Chhavimani Choubey
Chhavimani Choubey - 07.04.2023 08:02

weird block scope vs closure my mind is doing right now.

Ответить
Hamza
Hamza - 28.03.2023 21:45

Wow, Sina! Your last example on closures was exactly what I needed to finally appreciate their usefulness.

Previously, when passing a function to an event handler, I always wondered how I could pass something to that function while also passing it to the event handler.
I was concerned that it would execute immediately rather than when the event occurred, and that I would only have access to the event object.
However, your example has answered all of my questions.

Thank you so much, Sina! Your teaching style is phenomenal, and I would love to see you make a video tutorial on JS debouncing. I've watched a lot of videos on the subject, but I think your approach would be particularly helpful.

Ответить
Sahil Kumar
Sahil Kumar - 18.03.2023 13:42

Very good tutorial. That click handler example was too good. I used onClick in place of onclick and struggled for half an hour 😪

Ответить
Afaq Arif
Afaq Arif - 28.02.2023 14:26

Its not for beginners .. i might need 2 or 3 years so i can reach the level so i can understand..

Ответить
Baxilio
Baxilio - 27.02.2023 23:43

great video, thanks a lot for the effort

Ответить
Md Shoharab Pk
Md Shoharab Pk - 15.02.2023 16:42

you are so great and also your explanation is so great. thank you so much.

Ответить
Christopher Karlon
Christopher Karlon - 08.02.2023 21:45

3

Ответить
Scott Forslund
Scott Forslund - 07.02.2023 19:22

I have found the following two situations in websites with closures. I am wondering if you can shed light on why people would do this?

First, a function is invoked at return. Like the following (note that the wt function does not return a value):
return wt()

Second, a variable being set in a return. Like the following:
return t.m = e

If anyone that sees this can shed light on this it would be greatly appreciated. I'm utterly confused as to why anyone would do those.

Ответить
Mostafa Mohamed Atef
Mostafa Mohamed Atef - 06.02.2023 17:00

QOLI 🤣🤣

Ответить
Vinay Mathrubai
Vinay Mathrubai - 02.02.2023 14:26

super!! explained l

Ответить
Jithin K George
Jithin K George - 23.01.2023 21:13

thanks

Ответить
Jatil Yadav
Jatil Yadav - 23.01.2023 17:13

New Subscriber... Just loved your content...Want to gain more knowledge from your content... Keep uploading Best of luck Sir.........

Ответить
Tanvir Ahmed
Tanvir Ahmed - 16.01.2023 11:03

Isn't it the whole idea behind the class?

Ответить
A PQ
A PQ - 10.01.2023 09:01

What a great class you have brought us! I agree with you that this is a very though theme, but you had explained it with in a terrific way! Thank you Sina Qoli! 😃

Ответить