Why this?


#1

Oops, try again. When the computer tried to call calcPerimeter of a Rectangle object, the following error was thrown: TypeError: rec_test.calcPerimeter is not a function

function Rectangle(height, width) {
this.height = height;
this.width = width;
this.calcArea = function() {
return this.height * this.width;
}
// put our perimeter function here!
this.calacPerimeter=function(){
return (this.height + this.width)*2 ;
}
};
var rex = new Rectangle(7,3);
var area = rex.calcArea();
var perimeter = rex.calcPerimeter();
console.log(area, perimeter, rexHeight, rexWidth);


#2

... that's because you called your method 'calacPerimeter' and not 'calcPerimeter' -_-


#3

hahaha thanks a lot i just admired it for a whole hour and never find the issue .
thank u batman