Skip to content

Instantly share code, notes, and snippets.

@Joncom
Created August 22, 2013 02:35
Show Gist options
  • Save Joncom/6302577 to your computer and use it in GitHub Desktop.
Save Joncom/6302577 to your computer and use it in GitHub Desktop.
Object.defineProperty Example
test = 1;
obj = { test: null };
Object.defineProperty(obj, 'test', {
get: function() { return test; },
set: function(value) { test = value }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment