0

So I know that in JS function's this depends on where it called not where defined but why in the next code I get window object instead of obj ?

function foo(){
  bar();
}

function bar(){
  console.dir(this);
}

var obj={name:'foobar',f:foo};

obj.f();

0 Answers0