Why does the following code result in three times true?
I was excepting false for the second step.
    function foo() {
        this.bar = function () { };
    };
    console.log("foo - defined : " + typeof window.foo !== 'undefined');
    console.log("bar - defined : " + typeof window.bar !== 'undefined');
    foo();
    console.log("bar - defined : " + typeof window.bar !== 'undefined');
 
    