this Keyword in Different Contexts
Why might this code not work as expected?
const person = {
name: 'John',
greet: () => {
console.log(`Hello, ${this.name}`);
}
};
const person = {
name: 'John',
greet: () => {
console.log(`Hello, ${this.name}`);
}
};