Closed BMahoney08 closed 8 years ago
Just remember that this
is always equal to the object that "owns" the function you called. So if you have:
var cat = {
name: "Whiskers",
meow: function(){
console.log("Meow. I'm " + this.name);
}
}
...and you call:
cat.meow();
...any this
inside the meow
function will be equal to cat
.
Comfort 3/5 Completeness 5/5
Any help explaining how to use "this" is appreciated. Thank you!