Комментарии:
Thanks Beau,. After 2 years as a JS engineer, finally understood closures watching a 6 years old video
Ответитьwhat is the use case of this?
ОтветитьWow, just spend at least the past 2 hours trying to understand closures watching a few 20+ minute videos, reading up, etc.
This video is literally the shortest content out of any of them but it is the only one that is clear and logical and it definitely helped me understand closures.
Thank you!
The only problem I notice with Beau's teaching method is that he goes from 20km/h to 150km/h in one second. If you try to play it at 0.75x, sometimes it will feel too slow, but if you play it at 1x, he speaks too fast 30% of the time.
Ответитьso, the private variable in the parent container function is modified by the child container function?
Ex.
function parentFunction() {
let counter = 0
function childFunction() {
console.log("counter",counter)
console.log("counter increment",counter+=1)
}
return childFunction
}
let result = parentFunction()
result()
result()
result()
Great explanation thanks!
ОтветитьIt's when a function or variable has access to other variables within the scope or the environment it was created in. They are sometimes used to emulate private methods. Which can only be called by other methods in the same class. Since JS does not have a native way of doing this.
ОтветитьSo basically it's like a character in a sandbox game having access to all the stuff in their environment they exist within
Ответитьugh my brain hurts.
Ответитьwould greatly appreciate if you talk louder instead of adjusting my speaker every time :(
ОтветитьUh. What!?
ОтветитьThanks, I have watched several great tutorial channels and yet, closure is still something i'm not confident talking about.
ОтветитьWay too confusing of a presentation
ОтветитьYes, one of the better explanations I've come across, too ... Concise, too ...
ОтветитьThank you!
ОтветитьIt looks like a class emulation no ? You just instantiate an object called counter that has a property privateCounter and 3 methods in it.
ОтветитьDude...you cant use jargon with beginners. This was terrible
Ответитьthis is by far the best video - thanks
ОтветитьThank you! I was really confused by closures.
ОтветитьI finally understand!
Ответить