Understanding this in Different Contexts in Javascript


The value of this depends on how the function is called.

Source Code

let obj = {
  method: function() {
    console.log(this);
  }
};
obj.method(); // `this` refers to obj
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments