What's the error in 24/33


#1

function Rectangle(height, width) {
this.height = height;
this.width = width;
};
this.calcArea = function() {
return this.height * this.width;
};
// put our perimeter function here!
this.calcPerimeter=function(){
return 2*(this.height) + 2*(this.width) ;
};

var rex = new Rectangle(7,3);
var area = rex.calcArea();
var perimeter = rex.calcPerimeter();


#2

in your this.calcPerimeter function, try removing the parentheses from around this.height and this.width.


#3

Tips, anyone? Not passing. thanks!

function Rectangle(height, width) {
this.height = height;
this.width = width;
this.calcArea = function() {
return this.height * this.width;
};
// put our perimeter function here!

function calcPerimeter(height, width) {
this.height = height;
this.width = width;
this.calcPerimeter = function() {
return 2*this.height + 2*this.width;
};

var rex = new Rectangle(7,3);
var area = rex.calcArea();
var perimeter = rex.calcPerimeter();


#4

I found a solution. Looks like I didn't need to repeat this.height = height;

function Rectangle(height, width) {
this.height = height;
this.width = width;
this.calcArea = function() {
return this.height * this.width;
};
// put our perimeter function here!

this.calcPerimeter = function() {
return this.height * 2 + this.width * 2;
};
}
var rex = new Rectangle(7,3);
var area = rex.calcArea();
var perimeter = rex.calcPerimeter();