Skip to content

Instantly share code, notes, and snippets.

@cianclarke
Created April 30, 2013 19:11
Show Gist options
  • Save cianclarke/5491130 to your computer and use it in GitHub Desktop.
Save cianclarke/5491130 to your computer and use it in GitHub Desktop.
this & methods
var name = 'Jose';
var myObject = {
name : "Molly",
getName: function() {
return this.name;
},
getWrongName: function() {
return name;
}
};
console.log(myObject.getName());
console.log(myObject.getWrongName());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment