function outer(){
var b = 5;
function inner(){
var a = 12;
console.log(a + b);
}
return inner;
}
console.log(outer());
/*without closures, var b in the outer function will no longer exist
after the outer function has been invoked*/
/*closures preserves the scope chain of the enclosing function when it is invoked,
giving you access to the enclosing functions variables*/