Let’s Learn JavaScript Closures
Preethi Kasireddy
1.8K37

Thank you! I’ve been trying to wrap my head around them, and how they relate to currying and sending functions around as first-class objects, this article finally helped shed light on them.

In nestingEnv.js (the pseudo-code environment records for the nested structures section), shouldn’t `foo` and `test` also be in the custom identifiers listed in the Global environment? Not sure if typo or my understanding is incomplete.

Also, I’d love to see more of a treatment on why closures are useful, besides providing private variables. They seem to add a lot of complexity around reasoning about program behaviour, without much payout.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.