My Sample Code:
var sound = 'woof' //global variable
let dog = {
//sound: 'woof'
talk: function() {
console.log(this.sound)
}
}
let talkFunction = dog.talk
talkFunction() // result is undefined
I dont understand, when we have a global variable, this reffers to global object, why then sound variable is not called.