One of the primary purposes of closures is to create private variables and functions. In languages like JavaScript, where objects and functions are often public, closures allow for data to be encapsulated in a function scope, providing a way to restrict access to certain variables.
that's the point he's trying to explain, if we would have not used closure, we would have to create function for each text size but using closure we can do it by just creating one function and through it creating different sizes function in just one line!
@@adityakumar9431 But we can create one fn and then pass it different value like: changeSize(12); changeSize(20); why do we even need to create an inner function ???
@hrxgaurav ap thoda sa pgl wgl ho kya bhai kya tum ese galti nikaalte rehte Btw wo koi glti nhi h Tumko nhi padhna mt padho Or kaunse bade aadmi ban gye tum jo aapko तू से संबोधित नही कर सकते🙄
watched 10 videos of closures but here i understood it properly. Also the same adder functio question was asked in an interview round. Thank you
Your practical approach to promises is excellent; it's simple, precise, and impressive.
One of the primary purposes of closures is to create private variables and functions. In languages like JavaScript, where objects and functions are often public, closures allow for data to be encapsulated in a function scope, providing a way to restrict access to certain variables.
So encapsulation & abstraction are two main purposes for which it is used @piyushgargdev ?
@@anonymoushackerar7507 yes actually and so that outer functions can not access inner data, which means privacy and encapsulation
@@shubhsharma19 Can Anyone tell me use of closure in Real Application? Example please.
@@agirlfrom_mountains utility functions and function returning functions.
bro you are genius, teaching method very well ....
just found your channel bro, you explain topics in details and good thing is its not only for beginners but intermidiate can also learn something
Thank you so much bro 🚀
so beautiful, so elegant, just looking like wow... very helpful
in text sizer example we can create a function and onclick of button change the size of text, closure ki jarurat hinahi hai na.
that's the point he's trying to explain, if we would have not used closure, we would have to create function for each text size but using closure we can do it by just creating one function and through it creating different sizes function in just one line!
@@adityakumar9431 But we can create one fn and then pass it different value like: changeSize(12); changeSize(20); why do we even need to create an inner function ???
Lovely explained
💌💌💌💌💌💌💌
Fan of your channel
very good explanation😇❣
Very well explained
Just wow!!🎉
wow mannnn😃
Sir project me use kaise kare project bi banao plz
🙌🏼
If we can use Closure and make function inside function then time & space complexity increasing or not ??
thanks man
like lamba function in python
bro ye jo brackets ki line show ho ri ha isky liye kn c extension use kr rhy hain
Can't we just create one outer function to reach the same result? Why use another inner function?
practical use case is bad here
your videos are too good you just have to do it that change your thumbnail quality of this not good
Bhaiya achhe se nhi samjhaya aapne 😑
Sb kuch Bahut badhiya hai, but aap joo video me itna jayda "tum" word kaa use karte hai isiliye sahi nahi lagta.
Aadat se majbor bro
HRx pdne pe dhyaan do. Ek to piyush bhai ache se pdarhe hai, aur tumko tum , tu ki pdi hai
Mujhe bahot sahi lgta h apka tum bcoz aap hame padha rhe ho aur bahot hi awesome padha rhe
@hrxgaurav ap thoda sa pgl wgl ho kya bhai kya tum ese galti nikaalte rehte
Btw wo koi glti nhi h
Tumko nhi padhna mt padho
Or kaunse bade aadmi ban gye tum jo aapko तू से संबोधित नही कर सकते🙄