Dealing with Scope in Object methods containing 'this' keyword called by Event Listeners
问题 I've generalized my lack of understanding of the situation to this small problem. Here's what I think I know so far: I have an object myDog (a global variable). Dog has a member variable el that is an html element; because it's an element, I can add event listeners to it. So, when you click on myDog.el , it logs to the console the values of this.name and myDog.name . As expected because of scope, this.name is undefined and myDog.name is 'tye'. this inside of Dog.speak when invoked by the