function outer() {
var x = 10;
function inner() {
console.log(x);
}
inner();
}
outer();
function outer() {
var x = 10;
function inner() {
console.log(x);
}
return inner;
}
var innerFunc = outer();
innerFunc(); // 10
console.log(a); // undefined
console.log(b); // ReferenceError: b is not defined
var a = 10;
console.log(a); // 10
console.log(func1); // [Function: func1]
console.log(func2); // undefined
function func1() {
console.log('Function Declaration');
}
var func2 = function () {
console.log('Function Expression');
};