let person = {
firstname: 'Rotten',
lastname: 'Apple',
greet: () => console.log(`Hello ${person.firstname} ${person.lastname}!`),
greet2: function(){
console.log('Hello, ' + this.firstname);
}
};
person.greet();
person.greet2();
为什么以上两个功能都起作用,而这两个功能却不起作用?
greet: () => console.log(`Hello ${this.firstname} ${this.lastname}!`)
感谢您的回答