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.
this
refers to the objectthis
refers to the global objectthis
refers to the global objectthis
is undefinedthis
refers to the element that received the eventthis
to any objectVisit the following resources to learn more: