Answer
this is determined by how a function is called, not where it's defined:
- Default: standalone call →
undefined(strict) or global object. - Implicit:
obj.method()→thisisobj. - Explicit:
call/apply/bindsetthis. - new:
thisis the newly created object. - Arrow functions: no own
this; they capturethislexically from the enclosing scope.