I have never never understood the basics of these things like closures, lexical scoping and data structure etc. but this guy deserves hats off.... literally you need a gold medal for teaching in such an awesome way. i am first time commenting on any youtube coding video.
I have not shared your videos links to anyone but I have recommended many friends to watch your videos . if they don't know any topic and try to ask me then I use to say "AAGAR AAP NE CHAI AUR CODE PE HITESH SIR SE PDE HOTE TO MERE SE NHI PUCHTE ", No doubt you are super. keep making videos and get motivated . I started watching your videos 3 years back but i was never serious but now I am int the stream. Once again thank you sir.
Thank you so much sir Javascript ki Sabse best series provide krne ke liye Maine puri series follow Kiya jisse mujhe javascript samjh aane laga aur ab kudh se project bhi bana leta hoon.... Again Thank you so much sir 🙏
Aaapko hirday se naman hai prabhu......aapse to interview dene wale hi nahi balki interview lene wale ko bhi sikhna chahiye....aapka video to mai dekhta and like share karta rahta hu but ispe to aapne comment likhne ko majbur hi kar dia
yeah definetly sir it is one of the good examples of closures but still we can do the same task with the help of arrow function also here the code const orange = document.getElementById("orange"); const green = document.getElementById("green"); orange.onclick = () => clickHandler("orange") green.onclick = () => clickHandler("green") function clickHandler (color) { document.body.style.backgroundColor=`${color}` }
I don't see any video , but just came to learn about closure , and Hitesh sir's teaching is ABSOLUTEBEAUTY, and he teach me how to read documentation that most important thing for me
Ab Jake Maine aapko subscribe Kiya hai sir . Meri Jo aadat hai pehle dekhta hun uske baad believe karta hun 😅😅. Aapki playlist kafhi achi hai aur mujhe mja aaya aur maine aapne berojgar dosto ko bhej diya hai aur unko motivate bhi kar diya hai aur aapki playlist jarur dekhenge. Thank you so much Sir 🫡🫡
0:00 Introduction 1:55 Reading the MDN docs 3:23 Lexical Scoping 14:00 Closure 18:09 Practical Implementation very very helpful playlist Thank you so much sir for this Premium course on javascript for free..
Hitesh ji In this lecture you have explained this two topics very easily. The topics which sounds very difficult, you made it look very simple with awesome example. Thanks a lot
Sir very nice. aapney bilkul desi method me samjhaya to samajh aa gai otherwise mujhe 7 din ho gaey hen me isee topic par hi phsa hua tha. aksar videos or blogs me bohat mushkil examples di jati hen jo samajh me nai aaten.
25:40 so here's the explanation and my understanding of this particular example --- The onclick here requires a reference of a function so that it can call it when the click event occurs on corresponding button, we always pass reference in this type of situation to prevent the function to get executed immediately. But the problem is we can't just pass the reference of the function because as we know it requires the color in the form of parameter and we are noy storing the reference in variable like structure such as let refHolder = clickHandler; so we can't call the refHolder later with the color parameter later in code such as refHolder('blue'). In reality, we are giving the reference to onclick which doesn't have an in built functionality or human intelligence to call this clickHandler with argument based on the button. So now we actually have a tiny war between onclick() demanding a reference and clickHandler(color) which demands to be called with a parameter only otherwise error. Now in order to fullfill the demand of bith entities, we can we will indeed call the clickHandler() with color parameter passed ( demand fulfilled ) but at the same time we will do something that a reference is given to onClick function ( which it strictly demands ), we will return reference of an inner function which does the main work or logic( demand fulfilled ) ( Very important thing to note here is this could not have been achieved without the feature of lexical scoping )
FINALLY completed the series. This series of yours gave me confident to more dive into JS environment. I believe if I came across this masterpiece a year ago, It would've been a great investment. Thank you sir💗
Here is something different from other creator who doesn't give proper example of closures they only say closure is created when a function is defined inside another function and allowing inner function to access variable from outer function's scope. AS Well as they give simple example of lexical scope for understanding which is really tough for understanding this topic. But you nailed it guruji 👏
I have watched many channel for javascript but the way you explain all the concepts...i have really became fan of ur teaching style... Hat's off to you 🙌🙏 @chaiaurcode
Amazing sir . i have watching many videos about lexical scoping and closure but I can't understand but sir after watching yours videos now I realize that its very easy
यूट्यूब पर कोचिंग का खेल तो चलता रहेगा, कोर्स आएंगे, जाएंगे.. कभी फ्री बनेंगे कभी पेड लेकिन ये चाय और कोड रहना चाहिए इसका बेशकीमती जावास्क्रिप्ट का कोर्स अमर रहना चाहिए। ❤❤
Super Sir, 4 mobiles in my home so i have subscribed 4 times also i have subscribed office mail id too❤ thank you soooo much sir , i have not shared your videos links to any one but i told to lots of pepole that if you want to learn javascript then you watch the video of chai or code channel
ye only course hi nhi ye to js ka Ramban course h jisne chai or code se padh liya wo to bhul nhi sakta Thanks for hitesh sir chai or code will growth soon
Lexical scope is everywhere. All functions can access global variables. However variable or properties declared inside a scope is generally not accessible by the parent or global scope. I think the window itself is a function. I found it pretty early, but still, I hesitate to state this. Hitesh Sir if you're reading this comment then please correct me if I'm making any mistake.
23:32 here we can also fix this issue without closure ..but help of anonymous functions example given below function clickHandler(color) { document.body.style.backgroundColor = `${color}` } document.getElementById('red').onclick = function() { // anonymous function clickHandler('red') } document.getElementById('black').onclick = function() { // anonymous function clickHandler('black') }
Lexical scoping ensures that: 1) Functions have access to variables defined in their own scope and in any parent scopes. 2) Variables are not accessible outside the scope they are defined in, preventing unintended interactions and potential bugs.
00:03 The video will cover two interesting topics: closure and lexical scoping. 01:47 Understanding closure and its access to outer function scope with MDN docs. 05:36 Lexical scoping does not allow access to variables declared inside a function in the outer scope. 07:55 Inner functions have their own execution context and share memory with the outer function. 11:51 Understanding Outer and Inner Function. 13:37 Explanation of lexical scoping and its significance. Detail explanation of closure through an example 17:32 Lexical scoping and closure return the entire lexical scope of a function when a complete function is returned. 19:14 Using onClick event and changing background color in JavaScript 22:27 Understanding the difference between a function and a reference to a function. 24:03 In Summary Functions have access to variables defined in their outer scope. Closure allows a function to retain access to variables from its lexical scope
Sir abb to jitni bhi videos aa rahi hai sabb deshi ghee mil raha hai. 😂 saara maal abb last mai mil raha hai JS ka.prr abb chai aur code pe subscriber bhi toofaan ke saath chal rahe hain aage dhamaal machega esi playlist pe.Thank you @Hitesh Sir regularity ke liye.❤
Sir lexical Scope me wo family wala example (father to chaild and brother can't share to each other) wala consept kabhi nhi bhulunga , is tarike se apne samjhaya hai. ,
at 25:45 to make your code run, please make sure that you used these ` ` not " " or ' ' , if you used " " or ' ' your code won't work, coz value is only read in ` ` escape quotations
Sir ek videos ispe bana dijiye ki web development roadmap main step by step kon kon se language padhana hai because html,css,js ke bad confusion hone lagta hai
I have never never understood the basics of these things like closures, lexical scoping and data structure etc. but this guy deserves hats off.... literally you need a gold medal for teaching in such an awesome way. i am first time commenting on any youtube coding video.
Wow, thanks!
0:00 Introduction
1:55 Reading the MDN docs
3:23 Lexical Scoping
14:00 Closure
18:09 Practical Implementation
Ye hui na baat, ❤️
@@chaiaurcode ♥️♥️
sir i cannot understand closure @@chaiaurcode
you understand closure can you tell me closure
return child function inside parent function@@nehasalma9083
I have not shared your videos links to anyone but I have recommended many friends to watch your videos . if they don't know any topic and try to ask me then I use to say "AAGAR AAP NE CHAI AUR CODE PE HITESH SIR SE PDE HOTE TO MERE SE NHI PUCHTE ", No doubt you are super. keep making videos and get motivated . I started watching your videos 3 years back but i was never serious but now I am int the stream. Once again thank you sir.
apana poura dimage lagaya ha
mein bhe yahhe karuga insh'ALLAH
I tried many videos and channels for closures but finally I found this guy. Thank you so much sir
Happy to help🤗☕️
very very helpful playlist Thank you so much sir for this Premium course on javascript for free..
trust me sir! you will be known forever for this Javascript series! The Best on the planet!
Abhi to bs shuru hue h 😁
sir, when second part comes?@@chaiaurcode
Thank you so much sir
Javascript ki Sabse best series provide krne ke liye
Maine puri series follow Kiya jisse mujhe javascript samjh aane laga aur ab kudh se project bhi bana leta hoon....
Again Thank you so much sir 🙏
0:00 Introduction
1:55 Reading the MDN docs
3:23 Lexical Scoping
14:00 Closure
13:07 you are the best. baki youtubers k video ko dekh kar samjh nahi aya but yeh video dekh kar mere atma ko santushti mil gaya.
Aaapko hirday se naman hai prabhu......aapse to interview dene wale hi nahi balki interview lene wale ko bhi sikhna chahiye....aapka video to mai dekhta and like share karta rahta hu but ispe to aapne comment likhne ko majbur hi kar dia
application of this Lexical scope was totally new for me. very intersting
yeah definetly sir it is one of the good examples of closures but still we can do the same task with the help of arrow function also
here the code
const orange = document.getElementById("orange");
const green = document.getElementById("green");
orange.onclick = () => clickHandler("orange")
green.onclick = () => clickHandler("green")
function clickHandler (color) {
document.body.style.backgroundColor=`${color}`
}
I don't see any video , but just came to learn about closure , and Hitesh sir's teaching is ABSOLUTEBEAUTY, and he teach me how to read documentation that most important thing for me
Ab Jake Maine aapko subscribe Kiya hai sir . Meri Jo aadat hai pehle dekhta hun uske baad believe karta hun 😅😅. Aapki playlist kafhi achi hai aur mujhe mja aaya aur maine aapne berojgar dosto ko bhej diya hai aur unko motivate bhi kar diya hai aur aapki playlist jarur dekhenge. Thank you so much Sir 🫡🫡
0:00 Introduction
1:55 Reading the MDN docs
3:23 Lexical Scoping
14:00 Closure
18:09 Practical Implementation
very very helpful playlist Thank you so much sir for this Premium course on javascript for free..
Hitesh ji In this lecture you have explained this two topics very easily. The topics which sounds very difficult, you made it look very simple with awesome example. Thanks a lot
Sir very nice. aapney bilkul desi method me samjhaya to samajh aa gai otherwise mujhe 7 din ho gaey hen me isee topic par hi phsa hua tha. aksar videos or blogs me bohat mushkil examples di jati hen jo samajh me nai aaten.
Here I got Cristal cleared the concept of closure
Thank you so much sir 🙏🙏
Your way of teaching is awesome
Sir aap hr concepts ko practical examples se explain krte usse bhut ache se samj ata thanku sir for thi series😊❤️
yes i watched few other videos before this, lekin my concept got cleared when i watched this video. Thanks Hitesh Sir 🙂
25:40 so here's the explanation and my understanding of this particular example ---
The onclick here requires a reference of a function so that it can call it when the click event occurs on corresponding button, we always pass reference in this type of situation to prevent the function to get executed immediately.
But the problem is we can't just pass the reference of the function because as we know it requires the color in the form of parameter and we are noy storing the reference in variable like structure such as let refHolder = clickHandler; so we can't call the refHolder later with the color parameter later in code such as refHolder('blue').
In reality, we are giving the reference to onclick which doesn't have an in built functionality or human intelligence to call this clickHandler with argument based on the button.
So now we actually have a tiny war between onclick() demanding a reference and clickHandler(color) which demands to be called with a parameter only otherwise error.
Now in order to fullfill the demand of bith entities, we can we will indeed call the clickHandler() with color parameter passed ( demand fulfilled ) but at the same time we will do something that a reference is given to onClick function ( which it strictly demands ), we will return reference of an inner function which does the main work or logic( demand fulfilled ) ( Very important thing to note here is this could not have been achieved without the feature of lexical scoping )
FINALLY completed the series. This series of yours gave me confident to more dive into JS environment. I believe if I came across this masterpiece a year ago, It would've been a great investment. Thank you sir💗
1.5x me bhi ek hi baar me samajh aa gaya. waah kya chai hai haha. Thank you so much sir..
13:40 laxical scope completed awesome 🎉🎉
Simple Crisp Clear now i know about closure and lexical scoping.Thanks a lot Hitesh SIr
This is the best explanation for closures ever, Thanks man
finally i understood the lexical scope thank you sir for being here to teach us. love from nepal
Mini project based lexical scoping and closure example was cheery on the cake!!!!!
Here is something different from other creator who doesn't give proper example of closures they only say closure is created when a function is defined inside another function and allowing inner function to access variable from outer function's scope. AS Well as they give simple example of lexical scope for understanding which is really tough for understanding this topic. But you nailed it guruji 👏
Woww amazing. What a crystal clear explanation.
Thank-you so much sir.
best teacher ever seen in my coding phase escpecially in mern stack
koi bhi problem ho solution is always our ❤ hitesh sir
sir apke samjaneme ek calmness hai
I have watched many channel for javascript but the way you explain all the concepts...i have really became fan of ur teaching style... Hat's off to you 🙌🙏 @chaiaurcode
Finally 2nd time completed whole series
Thank You so much @Hitesh sir for such an amazing playlist 😍😍🤩🤩😇😇
Amazing sir . i have watching many videos about lexical scoping and closure but I can't understand but sir after watching yours videos now I realize that its very easy
Thanks alot for this course sir, best js course in youtube and mainly you never get bored
Kya shamjhaya sir, kya hi intelligence hy bhai, mza agya! Thank you soo much!
Revise after 4 month and this time understanding is mindblowing
Best explanation of Closures with example💯
यूट्यूब पर कोचिंग का खेल तो चलता रहेगा, कोर्स आएंगे, जाएंगे.. कभी फ्री बनेंगे कभी पेड लेकिन ये चाय और कोड रहना चाहिए इसका बेशकीमती जावास्क्रिप्ट का कोर्स अमर रहना चाहिए। ❤❤
Shi bat
'ataal' line bole ho !
@@krishnadawalkar6999 suits Atal line..only for Hitesh sir 💯
Bilkul shi baat hai
Badhiya aaisa sikhayege to koi bhi sikh jayega coding.
You are giving a great content for free. Hats off to you brother. Now I know what is lexical scoping and closures.
The best part of video is
ki ye parents child bhai bhai ke example se jo ye aapne sikhaya hai
mereko nahi lagta ki ham isko bhulenge
What a practical explanation, I don't have words to appreciate your work.
Hindi mai sikkh na is a superior way of learning, thank you Sir ji!
Super Sir, 4 mobiles in my home so i have subscribed 4 times also i have subscribed office mail id too❤ thank you soooo much sir , i have not shared your videos links to any one but i told to lots of pepole that if you want to learn javascript then you watch the video of chai or code channel
ye only course hi nhi ye to js ka Ramban course h jisne chai or code se padh liya wo to bhul nhi sakta Thanks for hitesh sir chai or code will growth soon
Lexical scope is everywhere. All functions can access global variables. However variable or properties declared inside a scope is generally not accessible by the parent or global scope. I think the window itself is a function. I found it pretty early, but still, I hesitate to state this. Hitesh Sir if you're reading this comment then please correct me if I'm making any mistake.
very intresting teaching style...wow sir☺👌👌👌
1:55 Reading the MDN docs
3:23 Lexical Scoping
13:33 Closure
18:09 Practical Implementation
Concise and crystal clear.. Awesome, Thanks ❤❤❤
Now I have confidence to learn React 😀😀
23:32
here we can also fix this issue without closure ..but help of anonymous functions example given below
function clickHandler(color) {
document.body.style.backgroundColor = `${color}`
}
document.getElementById('red').onclick = function() { // anonymous function
clickHandler('red')
}
document.getElementById('black').onclick = function() { // anonymous function
clickHandler('black')
}
"Chai aur Code, you've created a masterpiece with your JavaScript tutorials. Thank you for your brilliance!"
The best explanation of closures and lexical scope, thank you sir
yes deal done and thankyou for in depth js series lane k liye maza aa gya 90 % plus improvement in my js skill thankyou so much again and again
The best tutorial on the internet ever!
when i see first lecture i feel lecture is going very slow , but after some days this is a way to learn something
Awesome explanation for that last part "lexical scoping" in coloring background!
Thank you sir for this amazing series 😊
I am revising and literally no one explained like you ❤
Chai piyo coding karo.....sir bahot badiya samajh me aa gaya.
Lexical scoping ensures that:
1) Functions have access to variables defined in their own scope and in any parent scopes.
2) Variables are not accessible outside the scope they are defined in, preventing unintended interactions and potential bugs.
one of the best lexical scope and closure video ... maza aaya
"Hats off to Hitesh sir for his exceptional mentorship in the JavaScript series - truly inspiring! 🎩"
aaj dhire dhire krte krte pura series dekh aur sikh liya
Ek baar mein samak aagaya. Thnx Hitesh sir.
Thanks 🙏 SIR ❤
Hannnji
Hindi main aap ka voice bahat hi achha lagta hai.
i see bundle of lectures on this concept but u r the best kia bat hy app ki to
best Series ALL OVER THE UNIVERSE, thank you Sir 🙏
Sir Scoping ke andar apne samjahay aht Icecream ka example deke ab lag rha hai ke best javascript series ever 💌💌
this is a hepl full series and first impresive series in TH-cam for free thanks sir
00:03 The video will cover two interesting topics: closure and lexical scoping.
01:47 Understanding closure and its access to outer function scope with MDN docs.
05:36 Lexical scoping does not allow access to variables declared inside a function in the outer scope.
07:55 Inner functions have their own execution context and share memory with the outer function.
11:51 Understanding Outer and Inner Function.
13:37 Explanation of lexical scoping and its significance. Detail explanation of closure through an example
17:32 Lexical scoping and closure return the entire lexical scope of a function when a complete function is returned.
19:14 Using onClick event and changing background color in JavaScript
22:27 Understanding the difference between a function and a reference to a function.
24:03 In Summary Functions have access to variables defined in their outer scope.
Closure allows a function to retain access to variables from its lexical scope
Hatish bhaiya very very thanks for this Js series.
💕 From 🇵🇰
very well explained.
Thanks for such kind of explanation
0:00 introduction
1:55 Reading the MDN docs
3:23 Lexical Scoping
14:00 Closure..
finally koi yt ki playlist Finish kiya first time in my life
same here yr
My so many myths broken today related to closures, Thank you sir
Thankyou sir for making this playlist ❤❤
0:00 introduction
1:55 Reading Mdn docs
3:23 Lexical scoping
14:00 closures
Sir Thank you. I have learn lot of from you. You are GOD to me. ❤❤❤❤
kamal kr diya ap nay
behtareen in depth lecture
Sir abb to jitni bhi videos aa rahi hai sabb deshi ghee mil raha hai. 😂 saara maal abb last mai mil raha hai JS ka.prr abb chai aur code pe subscriber bhi toofaan ke saath chal rahe hain aage dhamaal machega esi playlist pe.Thank you @Hitesh Sir regularity ke liye.❤
Want more Videos on JavaScript like this !!!!😍
Best Closure and lexical scope Explanation sir😇
Glad you liked it
you are god of javascrript sir!
Thankyou so much sir for this after watch this video my closer concept perfectly clear thanks.🙏👍
thank you so much sir for this JS series.
12:20 That is toooo relatable btw. sir ji iye to thoda dark ho gaya
Sir lexical Scope me wo family wala example (father to chaild and brother can't share to each other) wala consept kabhi nhi bhulunga , is tarike se apne samjhaya hai. ,
Ye same example, English Channel pe kaafi famous hua tha. Acha laga ki yaha b sabko psnd aaya
thanks sir for this series. today, I completed this series 😊😊
at 25:45
to make your code run, please make sure that you used these ` ` not " " or ' ' , if you used " " or ' ' your code won't work, coz value is only read in ` ` escape quotations
Thank you sir ❤.. maza aya apke sath smoothly js padh paya 🤌
Sir advanced javascript concept ke videos add kijiye is playlist pe. Bhaiya Debounce aur throttle pe video bnaiye please.
kaafi achha samjhate ho sir
sir i liked your speed of teaching, love u sir
finally javaScript Chai is ENDDDDD...☕☕❤❤
kia baat hai itna achha explain paid course mai bhi nhi milta
Thanks ji,
Love you frome Bangladesh,its a nice course,...moja agaya dost
Always welcome
Sir ek videos ispe bana dijiye ki web development roadmap main step by step kon kon se language padhana hai because html,css,js ke bad confusion hone lagta hai