Functions
Closures in JavaScript
Closures are inner functions declared within outer functions.
Syntax
function outerFunction(passedParameters) {
//closure
function(passedParams2) {
//closure code
}
}
Notes
Closures have access to variables declared in the outer function, as well as global variables.
Example
function square(number) {
function multiply(a, b) {
return a * b;
}
return multiply(number, number);
}