According to my understanding, the code below should output undefined when I call hi()
but instead it logs a number. I'm using chrome. Can somebody elaborate why is this happening? Thanks in advance.
Screen shot of Code:
const obj = {
name: "abc",
sayHi: function() {
console.log(this.name)
}
}
obj.sayHi();
let hi = obj.sayHi;
hi();