Created
February 9, 2017 03:41
-
-
Save MarcusHurney/c417318db1e6a236e4ec0bb8f4adf07e to your computer and use it in GitHub Desktop.
how to use self
This file contains hidden or 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 person = { | |
name: 'Marcus', | |
sayName: function() { | |
var self = this; | |
function changeName() { | |
self.name = 'Anonymous'; | |
console.log(self.name); | |
} | |
changeName() | |
} | |
} | |
person.sayName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment