Guest User

Untitled

a guest
May 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. // this is (of course) a horrible simplification
  2. // but assume that all objects have something like this...
  3. function _get_set(prop, value){
  4. if(typeof(value) !== "undefined"){
  5. this['_' + prop] = value;
  6. }
  7. return this['_' + prop])
  8. }
  9.  
  10. thing = {
  11. height: function(value){ _get_set('height', value) }
  12. width: function(value){ _get_set('width', value) }
  13. }
Add Comment
Please, Sign In to add comment