please could you help me to understand why if I run following example from the book - I get first call to foo() undefined instead of 'global' in nodejs?
Thanks!
function foo() {
  console.log( this.bar );
}
var bar = "global";
var obj1 = {
  bar: "obj1",
  foo: foo
};
var obj2 = {
  bar: "obj2"
};
foo();              // here I get undefined instead of "global" ...
obj1.foo();         // "obj1" 
foo.call( obj2 );   // "obj2" 
new foo();          // undefined 
