Introduction
A closure lets a function remember the variables from the place where it was created, even if it runs somewhere else later.
When you want to keep some data private inside a function.
When you want to create a function that remembers a value between calls.
When you want to make a function factory that creates similar functions with different settings.
When you want to avoid using global variables but still share data between functions.