foo()”, properties are accessed like “
bar.foo”, and methods are called like “
bar.foo()”. Looks straightforward enough, right?
this”, in the method body, to the object the method was invoked on.
And when does
this happen? When you use the method call syntax.
bar.foo() is not the same as
var m = bar.foo; m();
(It is the same as
call is a method on function objects which invokes them with
this bound — but that's beside the point.)
So, the syntax is non-compositional.
Not only that, but it is enthusiastically so:
bar.foo() is the same as
(bar.foo)() — the parentheses do not break up the method call construct!