"This" is used differently in JavaScript from how it is used in most other programming languages.
The five ways "This" can be used in JavaScript include:
In a global scope to refer to the global object
To refer to the global function when calling a function
Calling a method
To refer to a newly created object when calling a constructor
Explicit setting to the first argument of a corresponding function call
Source:JavaScript Garden
Top comments (0)