Perimeter (or Circumference) Help


#1

Here is my code - it comes with a type error:
Uploading...
I don't know what is wrong with it!


#2

If it doesn't upload:

The Type Error:

Oops, try again. Your code caused a TypeError when trying to call .perimeter(). Make sure you have properly defined the perimeter method. Use the .area() method as a guide. Here's the error message: TypeError: c.perimeter is not a function

 The Code:

function Circle (radius) {
    this.radius = radius;
    this.area = function () {
        return Math.PI * this.radius * this.radius;
        
    };
};
    // define a perimeter method here
function Perimeter (radius) {
    this.radius=radius;
    this.perimeter = function (){
        return 2*Math.PI*radius;
    };
};

#3

Hi @vhorus,

Hint: (1) You have to write perimeter method (not Perimeter) (2) perimeter should be a method of Circle class. Currently, you have created a new Perimeter class.