what is clouser in javascript code example
Example 1: closure in javascript
function makeFunc() {
var name = 'Mozilla';
function displayName() {
alert(name);
}
return displayName;
}
var myFunc = makeFunc();
myFunc();
Example 2: closure in javascript
A closure is a function bundeled together with its lexical scope