this in a Method and in a Function
For ordinary functions, this depends on how a function is called. Calling object.method() supplies object as the receiver; a detached strict function call has undefined this.
The object owning the call expression matters more than where the function was stored originally.
See the mechanism
article.readTitle()articleFollow one example
article.readTitle() supplies article as this. Copying the function into detached does not preserve that receiver. The strict standalone call has undefined this, so reading this.title throws. Strictness belongs to the relevant function code; do not assume every standalone call in every script returns the same global object.
Predict, change and check
Predict: Would assigning detached to another object and calling other.readTitle() use the old article or the new receiver?
Test your explanation: Create another receiver with title Night and call the copied method through it. Explain the result from the call site.
The tasks below ask you to explain that result and apply the idea to different inputs.
Apply and distinguish
The call site supplies an ordinary receiver
For an ordinary function, this depends on how it is invoked, not simply where its source text was written. Calling article.read() supplies article as a receiver; assigning article.read to a variable and invoking it as a plain function loses that call-site receiver.
In strict mode a plain function call supplies undefined as this. Non-strict ordinary functions can substitute or box the receiver. Inspect the actual call expression before trying to fix a method with a random bind. A nested ordinary callback does not automatically inherit its containing method's receiver.
Check your understanding: State the input contract, identify the operation that changes the result, and give one boundary input that would distinguish the correct rule from the mistake described above.