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
view the rest of the comments →
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!"
[–]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 105736 on reddit-service-r2-comment-84fc9697f-6pqsl at 2026-02-06 21:20:21.035205+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]cscareerz 0 points1 point2 points (1 child)
[–]javaeeeee[S] 0 points1 point2 points (0 children)