Lexical environment
by podlipensky
JavaScript
var x = 10;
(function (funArg) {
var x = 20;
funArg(); // 10, not 20
})(function () { // create and pass a funarg
console.log(x);
});
by podlipensky
var x = 10;
(function (funArg) {
var x = 20;
funArg(); // 10, not 20
})(function () { // create and pass a funarg
console.log(x);
});