var x = 3; var foo = { x: 2, baz: { x: 1, bar: function() { alert(showThis.call(this)); return this.x; } } }; var go = foo.baz.bar; function showThis() { return this === window ? '[object global]' : JSON.stringify(this); } go(); foo.baz.bar();