2017, Mar 24

# ‘This’ Parameter in JavaScript

## Q: How to get the actual value of the parameter this?

• this will alwas take the value of the apearing on the left side of the .
• If there is no . in method call this will refer to the global object
• What if we want to define this our selfes without making the methon as a property of another object
• We can do that by using call method
• Even we can overwrite the default . rule to pass a custom object to this to refer to using call method like that
• what will happen When some function is passed as a parameter to another function this
• The only moment that matter is when the function get invoked not when it is passed, So this will also print out global not r
• Now let’s try this example, this will behave like normal in such case as the calling time is what we are caring of
• For the last example we can see new object empty object created in case we used new with our call