Methods


#1

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

When run it says 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


#2

Your code should all be inside the constructor function body.

function Circle(radius) {
    this.radius = radius;
    this.area = function() {

    };
    this.perimeter = function() {

    };
}