In the following code, I can call baz. Also somewhere else I read "JavaScript has function-level scope". I know, Im confusing myself somewhere. Can somebody make me understand please?
/* An anonymous function used as a closure. */
var baz;
(function() {
var foo = 10;
var bar = 2;
baz = function() {
return foo * bar;
};
})();
baz(); // baz can access foo and bar, even though it is executed outside of the
// anonymous function
.