let user = {
  name: "John",
  age: 30,
  sayHi() {
    alert(this.name);
  }
};
user.sayHi(); // John
function sayHi() {
  console.log(this.name);
}
function sayHi() {
  alert(this);
}
sayHi(); // undefined

this and Reference Type

let user = {
  name: "John",
  hi() { console.log(this.name); },
  bye() { console.log("Bye"); }
};
user.hi(); // John
const targetMethod = (user.name === "John" ? user.hi : user.bye);
targetMethod(); // Undefined, because the context the method call is undefined.

Arrow Functions Have No “this