Code:
function bar() {
        alert(this);
}

bar(); //global
this outputs the following in an alert:
[object]

I'm reading about execution context and javascript and supposedly the above example is global execution context.

What i want to know is why it prints out object?

since this is global, i would think it would alert global.

________________


Next example

Code:
var foo = {
baz: function() { 
alert(this);
}

}

foo.baz();
What this does, is it prints out an alert that says [object Object]

my question is why is there a capital object along with a lowercase o object.

I'm wondering what the object is. and why doesn't it print out foo since foo is the object. and when i run alert (this), it's being run inside the foo object.

This is getting confusing for me.