Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
A closer is a function inside a function that access a variable outside its scope. It is important to know a closure may or may not return a value.
Example:
=======
function count() {
var i =0; // name is a local variable created by init
function countNum() { // countNum() is a function inside a function, A Closure
i +=1; // 'i' is a variable declared in the parent function outside countNum()
}
countNum();
}
count();