I have the following code:
const person = {
name: 'Bob',
greet: () => {
console.log(`Hi, my name is ${this.name}`);
}
};
person.greet();
For some reason, it outputs:
Hi, my name is undefined
I'd expect it to output:
Hi, my name is Bob