24. Constructors With Methods (Unexpected Number Error)


#1



https://www.codecademy.com/en/courses/spencer-sandbox/3/5?curriculum_id=506324b3a7dffd00020bf661#

What is wrong with my code?? Please explain my mistake. Thank you
Error : Unexpected Number Error

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 () {
    reutrn 2 * this.height + 2 * this.width;
  };
}

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


#2

@feedingmycuriosity,

Have a close look at

reutrn


#3

Thank you for always helping


#4

This post was flagged by the community and is temporarily hidden.


#5

Olá.
Atente ao seguinte:

function Rectangle(height, width) {
this.height = height;
this.width = width;
this.calcArea = function() {
return this.height * this.width;
};
// coloque sua função de cálculo do perimetro aqui!
this.calcPerimeter = function() {
return this.height * 2 + this.width * 2;
}

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