Created
July 30, 2018 18:04
-
-
Save kristyburge/76f7b6820240abeffdd0469127105eed to your computer and use it in GitHub Desktop.
When 'this' is used inside an object, it points to the object itself
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dog = { | |
name: 'Chester', | |
breed: 'beagle', | |
intro: function(){ | |
console.log(this); | |
} | |
}; | |
dog.intro(); | |
// returns the dog object and all of it's properties and methods | |
// {name: "Chester", breed: "beagle", intro: ƒ} | |
// breed:"beagle" | |
// intro:ƒ () | |
// name:"Chester" | |
// __proto__:Object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment