Created
July 27, 2010 21:35
-
-
Save twobitfool/492915 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is (of course) a horrible simplification | |
// but assume that all objects have something like this... | |
function _get_set(prop, value){ | |
if(typeof(value) !== "undefined"){ | |
this['_' + prop] = value; | |
} | |
return this['_' + prop]) | |
} | |
thing = { | |
height: function(value){ _get_set('height', value) } | |
width: function(value){ _get_set('width', value) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment