Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 26, 2016 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/5bf18f76e5e284edc5e9984f49150618 to your computer and use it in GitHub Desktop.
Save codecademydev/5bf18f76e5e284edc5e9984f49150618 to your computer and use it in GitHub Desktop.
Codecademy export
function Rectangle(height, width) {
this.height = height;
this.width = width;
this.calcArea = function() {
return this.height * this.width;
}
};
function Perimeter(height, width) {
this.height = height;
this.width = width;
this.calcPerimeter = function() {
return (this.height * 2) + (this.width * 2);
}
};
var rex = new Rectangle(7,3);
var area = rex.calcArea();
var perimeter = rex.calcPerimeter();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment