var foo = 'outer';
function outer() {
var foo = 'closure';
var bar = 'baz';
return function inner() {
console.log(foo);
}
}
I understand that foo
will be closed over, because inner()
will need it.
But will bar
be closed over also? It's in inner()
's scope, but it isn't being used by inner()
.