Skip to content

Instantly share code, notes, and snippets.

@DominicFinn
Created September 4, 2012 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DominicFinn/3623706 to your computer and use it in GitHub Desktop.
Save DominicFinn/3623706 to your computer and use it in GitHub Desktop.
Javascript Properties with ECMA Script 5 Properties
function Person() {
var name = '';
Object.defineProperty(this, 'name', {
get: function() {
return name;
},
set: function(val) {
name = val;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment