bind(), call(), and apply()
Why will this code fail to display the name correctly?
const person = {
name: 'John',
greet: function() {
console.log(`Hello, ${this.name}!`);
}
};
const greetFunction = person.greet;
greetFunction();
const person = {
name: 'John',
greet: function() {
console.log(`Hello, ${this.name}!`);
}
};
const greetFunction = person.greet;
greetFunction();