Case1: 'this' always takes the context of the object in relation to which it is called.
In p.printName (), the context is p, so 'this' refers to the Person object to which "p" refers.
Option 2: But, when you direct the funcRef method to p, it loses this context, and 'this' refers to the global object.
The global object may be different depending on the js environment (e.g. browser context or node, etc.).
That is why you see different results.
source share