24. Constructors With Methods


#1


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


SyntaxError: Unexpected end of input

That's the error I recieve. I don't know why pls help me!


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

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


#2

the { on this line:

function Rectangle(height, width) {

doesn't have a matching closing }, close the Rectangle function at the right spot


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.