A short video explaining the concept of closures, using JavaScript. This is part of a series, where are learning functional programming using JavaScript.
Mozilla JavaScript documentation on Clousures
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
Code from the episode
https://gist.github.com/mpj/b56371c672122a098d52
Playlist of full series
You want to follow me on Twitter and Quora:
Tweets by mpjme
http://www.quora.com/Mattias-Petter-Johansson
Original source
29 responses to “Closures – Part 5 of Functional Programming in JavaScript”
Very simple and clear explanation. Thank you!
Your videos are amazing, I cant feel the time passing hahaha, Subscribed!
Hey Mattias, another great video! I do have nightmares about memory leaks every time I heard in closures!! Please help me to sleep well and MAKE AN EPISODE ABOUT MEMORY LEAKS!!
Cuurrrrryyynnnnggggg
What an amazing description. good job
if i am not wrong ,clouser is something like global variables in c++,VB.net or c#.
I have never seen such a beautiful video.
May god bless you and bless us with more videos on .js
You have a typo in the show notes . Should say Closures not Clousures ?
hm… C doesn't have closures, but C can print out the name just like what your first example does…
Can you explain why closures are excluded from the whole only-inputs-and-outputs approach in FP?
I'm a complete newb so I'm a bit confused X_X
I only have some basic student level experience with Java and this just seemed like standard scoping to me?
Is the "scoping" in java also "closures" (the way access trickles down) and I just haven't been exposed to the terminology?
Someone help X_X
Great Matias I liked!
Thank you, > & > = (me)learning;
Can I ask why you don't use semicolons? I am learning and this is the first time I have really seen someone write JS without semicolons. Is there a strategy or reason?
Very clear explanation. Thank you.
I am so happy to have found your channel! Thank you for your unpretentious explanation of these concepts. You make me feel as though it is simple and that I van easily learn this terms that have, more or less, eluded me in the abstract.
0:38 nothing to click therrrrrre.
What about [[Scopes]].Closure ?
can anybody tell me when i need to use closures…? and give me real world example where closure exist..?
so this is just global variable?
Thanks for the video….I thought of closures as higher stuff for super-seasoned JavaScripters until I met YDKJS. If anyone wants more of closures (the best explanation of closures I know of as of now), please meet "You Don't Know JS — Scope & Closures." ==> https://github.com/getify/You-Dont-Know-JS
I'm at 5:07.requestID is already in the sendRequest() and so is the S.ajax function-why is it amusing?When both are under the same function-for one to be able to access the other isn't no big deal right?
Thanks for your helpful video.
I've recently started learning functional programming but I am familiar with global variables in PHP and can't understand the differences between Global variables and Closures!!! What I got from your tutorial is that Closures aren't about variables, but functions and when we assign a variable actually we put it in the scope so every function can see it. please correct me if I am wrong.
My biggest questions is; how the fuck did you keep that ikea plant alive? Mine got like 2 minutes of drafty air and decided to drop all leaves in some kind of retarded emergency move.
Thanks for the good examples. Very helpful.
Where did you get your music? Thanks for the great video
so how is this different then global variables with a different name?
How to change path in Node ?) It's always C/users… I need chnge it to D:… on Windows
can get more deep about object literals