Whats wrong



Oops, try again. There was a problem with your syntax.

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();
console.log(rex, area, perimeter);


Put a curly bracket after this line:


There is one already?


I ran the code on repl.it

seems what Mohamed was suggesting above is half correct but you need to add another closing brace after the one you already have.


The curly bracket which already exists is for Rectangle function.


the mistake was of curly braces


Yes... :slight_smile:


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