Roadmap to becoming a developer in 2022
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
creat call-apply-bind-methods readme files (#2172)
2 years ago
..
100-function-borrowing.md Added content to Javascript This keyword (#1990) 2 years ago
101-this-in-a-method.md Update 101-this-in-a-method.md (#2035) 2 years ago
102-this-in-a-function.md Added content to Javascript This keyword (#1990) 2 years ago
103-using-this-alone.md Added content to Javascript This keyword (#1990) 2 years ago
104-this-in-event-handlers.md Added content to Javascript This keyword (#1990) 2 years ago
105-this-in-arrow-functions.md Added content to Javascript This keyword (#1990) 2 years ago
106-explicit-binding.md Added content to Javascript This keyword (#1990) 2 years ago
107-call-method.md creat call-apply-bind-methods readme files (#2172) 2 years ago
108-apply-method.md creat call-apply-bind-methods readme files (#2172) 2 years ago
109-bind-method.md creat call-apply-bind-methods readme files (#2172) 2 years ago
readme.md Added content to Javascript This keyword (#1990) 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