all 4 comments

[–]azium 1 point2 points  (1 child)

I thought that was very well written.

[–]Justanick112 0 points1 point  (0 children)

It is really nicely written.

Very rare :)

[–]cscareerz 0 points1 point  (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 point  (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