“A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function’s scope from an inner function. In JavaScript, closures are created every time a function is created, at function creation time.”

Key Points:

Closure is a function returns another function.

Example:

We have an outer function called outer(). It creates a local variable called counter and a function called inner(). The inner function also has a local variable called innerCounter and the inner function can access the variable (counter) from outer function:

Sources: