You do not know the JS series (25) - an indirect reference

You may have intentionally or unintentionally create a function of "indirect references", in this case, the application calls this function will default rule
Indirect references most likely to occur when the assignment:
function foo(){
  console.log(this.a);
}
var a = 2;
var o = { a: 3, foo: foo};
var p = { a: 4 };
o.foo(); // 3
(p.foo = o.foo)(); // 2
Assignment expression p.foo = o.foo return value is a reference to the objective function, so the position is to call foo (), not o.foo (). According to default binding implicit binding said before, there will be applications

Guess you like

Origin www.cnblogs.com/wzndkj/p/12453477.html