01 / Foundation
Understand the concept
The value of 'this' is determined by how a function is invoked, not where it is defined.
Understanding 'this' is essential because it behaves differently in regular functions, arrow functions, object methods, constructors, and event handlers.
02 / Implementation
Object Method vs Regular Function
this.js
const person = {
name: "John",
greet() {
console.log(this.name);
},
};
person.greet(); // John
const greet = person.greet;
greet(); // undefined (strict mode)
04 / Interview