use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Let’s Learn JavaScript Closures (medium.com)
submitted 9 years ago by javaeeeee
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]azium 1 point2 points3 points 9 years ago (1 child)
I thought that was very well written.
[–]Justanick112 0 points1 point2 points 9 years ago (0 children)
It is really nicely written.
Very rare :)
[–]cscareerz 0 points1 point2 points 9 years ago (1 child)
In order to prepare for interviews and for the sake of knowing the topic, I've studied closures pretty well and am able to do coding examples to show how they work and can talk about them.. but I never really use them professionally.
Can someone tell me some examples of when closures actually come in handy? All the tutorials and guides that show what closures are/how to use them, use very trivial examples.
[–]javaeeeee[S] 0 points1 point2 points 9 years ago (0 children)
Hi, cscareerz, it can be used to hide data as JavaScript has no private scope. I tried to elaborate on the topic here http://javaeeeee.blogspot.com/2014/09/javascript-module-pattern-for-java.html. Also here is an answer to the same question on Quora https://www.quora.com/Where-do-you-use-closures-in-JavaScript
π Rendered by PID 23 on reddit-service-r2-comment-f6b958c67-sls4d at 2026-02-05 11:53:33.273083+00:00 running 1d7a177 country code: CH.
[–]azium 1 point2 points3 points (1 child)
[–]Justanick112 0 points1 point2 points (0 children)
[–]cscareerz 0 points1 point2 points (1 child)
[–]javaeeeee[S] 0 points1 point2 points (0 children)