Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 6, 2016 02:46
Show Gist options
  • Save codecademydev/d359e223c38ab1882a038ff209da15f3 to your computer and use it in GitHub Desktop.
Save codecademydev/d359e223c38ab1882a038ff209da15f3 to your computer and use it in GitHub Desktop.
Codecademy export
var rectangle = new Object();
rectangle.height = 3;
rectangle.width = 4;
// here is our method to set the height
rectangle.setHeight = function (newHeight) {
this.height = newHeight;
};
// help by finishing this method
rectangle.setWidth = function (newWidth) {
this.width = newWidth;
};
rectangle.setHeight(6);
rectangle.setWidth(8);
// here change the width to 8 and height to 6 using our new methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment