Default Binding
If you are in strict mode, default to this keyword is undefined. If you are not in strict mode, default to this keyword is global object.If we execute the code in strict mode, it will give following output.
Implicit Binding
In here this key word is automatically bind to the calling object.Explicit Binding
If you use .call or .apply at the call side, the first parameter is this binding.New keyword
When you put the new keyword, then function become a constructor call which means brand new object will be created and that object becomes the 'this' within the function call. In my previous post I explained about javascript new keyword.Precedence of above rules with relates to this keyword
- Is it using new keyword?
- Is it using explicit binding?
- Is it using implicit binding?
- Is it using default binding?
No comments:
Post a Comment