Closure: It’s not a complex concept. Yet it’s hard to describe. Sure, a lot of programming jargon is abstract and requires a little bending of one’s mind. Polymorphism, reflection, encapsulation — hell, even abstraction is an abstract concept.
Mozilla’s docs describe closures like so:
Closures are functions that refer to independent (free) variables.
In other words, the function defined in the closure ‘remembers’ the environment in which it was created in.
Functions can be defined inside of other functions. An inner function of course has access to its parameters and variables. An inner function also enjoys access to the parameters and variables of the functions it is nested within. The function object created by a function literal contains a link to that outer context. This is called closure.
… inner functions get access to the parameters and variables of the functions they are defined within (with the exception of
Wikipedia describes closures like so:
In programming languages, a closure (also lexical closure or function closure) is a function or reference to a function together with a referencing environment—a table storing a reference to each of the non-local variables (also called free variables or upvalues) of that function. A closure—unlike a plain function pointer—allows a function to access those non-local variables even when invoked outside its immediate lexical scope.
Stack Overflow has a hugely popular thread on the subject, complete with helpful examples. Another succinct definition:
a closure is one way of supporting first-class functions; it is an expression that can reference variables within its scope (when it was first declared), be assigned to a variable, be passed as an argument to a function, or be returned as a function result.
Of course, most of this is hard to understand without some hands-on. Check out the Stack examples and write some experimental code yourself to really get your head around it.