24/33: TypeError: rec_test.calcPerimeter is not a function


#1

Hello,
I am unable to decipher this error message after hitting submit button: 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. Where is rec_test??
Also, in the console, this error appears: TypeError: rex.calcPerimeter is not a function

Instructions: Define a new method on line 8, calcPerimeter, which calculates and returns the perimeter for a Rectangle in terms of height and width.

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

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

Thanks!!


#2

You mispelled perimeter in the function. try fixing that and see what happens. The rec_test.calcPerimeter might just be a test on their side to make sure it's right.