Skip to content

Instantly share code, notes, and snippets.

@mdmartinez
Last active November 8, 2015 22:33
Show Gist options
  • Select an option

  • Save mdmartinez/9621e23e193f1c8ac9b9 to your computer and use it in GitHub Desktop.

Select an option

Save mdmartinez/9621e23e193f1c8ac9b9 to your computer and use it in GitHub Desktop.
var Animal = function() {
var _name;
this.animalType;
this.setName = function(name) {
_name = name;
};
this.getName = function() {
return _name;
};
};
var myCat = new Animal();
myCat.setName("Mr. Jones");
myCat.animalType = "cat";
myCat.animalType; // => "cat"
myCat.getName(); // => "Mr. Jones"
myCat._name; // => undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment