Skip to content

Instantly share code, notes, and snippets.

@rhyolight
Created March 19, 2010 16:27
Show Gist options
  • Save rhyolight/337776 to your computer and use it in GitHub Desktop.
Save rhyolight/337776 to your computer and use it in GitHub Desktop.
Rectangle = function(w,h) {
var width = w, height = h;
return {
getWidth: function() { return width; },
getHeight: function() { return height; },
setWidth: function(w) { width = w; },
setHeight: function(h) { height = h; },
area: function() { return width * height },
toString: function() { return '(' + width + 'X' + height + ')' }
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment