let person = {
name: 'Jack',
age: 25,
sayName: () => {
// this refers to the global .....
//
console.log(this.age);
}
}
person.sayName(); // undefined
var chopper = {
owner: 'Zed',
getOwner: function() {
return this.owner;
}
};
// or
var chopper = {
owner: 'Zed',
getOwner() {
return this.owner;
}
};