computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
om agarwal
12e17dfb68
|
2 years ago | |
---|---|---|
.. | ||
100-function-borrowing.md | 2 years ago | |
101-this-in-a-method.md | 2 years ago | |
102-this-in-a-function.md | 2 years ago | |
103-using-this-alone.md | 2 years ago | |
104-this-in-event-handlers.md | 2 years ago | |
105-this-in-arrow-functions.md | 2 years ago | |
106-explicit-binding.md | 2 years ago | |
107-call-method.md | 2 years ago | |
108-apply-method.md | 2 years ago | |
109-bind-method.md | 2 years ago | |
readme.md | 2 years ago |
readme.md
This Keyword
In JavaScript, the this
keyword is a little different compared to other languages. It refers to an object, but it depends on how or where it is being invoked. It also has some differences between strict mode and non-strict mode.
- In an object method,
this
refers to the object - Alone,
this
refers to the global object - In a function,
this
refers to the global object - In a function, in strict mode,
this
is undefined - In an event,
this
refers to the element that received the event - Methods like call(), apply(), and bind() can refer
this
to any object
The JavaScript this
Keyword
This Keyword