Skip to content

Instantly share code, notes, and snippets.

@MarcusHurney
Created February 9, 2017 03:41
Show Gist options
  • Save MarcusHurney/c417318db1e6a236e4ec0bb8f4adf07e to your computer and use it in GitHub Desktop.
Save MarcusHurney/c417318db1e6a236e4ec0bb8f4adf07e to your computer and use it in GitHub Desktop.
how to use self
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