let student = {
fname: "Carlos",
lname: 'Dubón',
sayHi(){
alert(`Hi my name is ${this.fname}`);
},
sayBye: function() {
alert(`Bye ${this.fname}`);
},
sayHiAgain: ()=> {
alert(`Hi my name is ${this.fname}`);
}
}
student.sayHiAgain();
I'm new to OOP in Javascript, I understand that the 3 ways in which I wrote a method work exactly the same.
student.sayHi();
works and shows up the alert => "Hi my name is Carlos"
but student.sayHiAgain();
shows up the alert => "Hi my name is undefined"
What am I missing?