I have a problem with an online jquery site document about the javascript area. There are codes;
(function() {
var baz = 1;
var bim = function() {
console.log( baz );
};
bar = function() {
console.log( baz );
};
})();
And says:
console.log( baz ); // baz is not defined outside of the function
what I don't understand is that even if it is bazdetermined why console.log(baz)there is undefined. Because I think the scope is the same. Did I miss something?
source
share