How do JavaScript closures work?

This question’s answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions. How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves? I have … Read more