Arrow functions have a bound lexical scope. So in this code person.person1.sayName() is supposed to output HB but instead it outputs GOT (the global scope). Why is this so?
var name = "GOT";
var person = {
name : "HB",
sayName : function() { return this.name },
person1 : {
name : "WW",
sayName : () => this.name
}
};
console.log(person.person1.sayName());