Answer + explication 👇
When you are dealing with ‘this’ in a function, ‘this’ value depends on how you are invoking the function. If you invoke a methods through an object, the
thisvalue will be equal to this object! so when you are doing user.action() the value of this is equal to user!
But when you are doing const newFunction = user.action, you are storing the methods into a new variable, and when you are doing newFunction(), you are invoking the function without an object. So the value of ‘this’ is undefined!
If you need to have the ‘this’ value into newFunction you need to use apply to pass the context into the function, so if you are doing newFunction.apply(user) you will have “@Code__Oz”!