33/33 Methods. I don't Understand Please help


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

#2

You have to add a new method. So we can be sure that you have to write something really similar to code of area method:

this.area = function () {
    return Math.PI * this.radius * this.radius;
};

You will want to change two things:

  1. Name, from area to perimeter.
  2. Returned value. You want to calculate perimeter, the formula is simple: 2 * radius * pi. Remember that you have to use Math.PI and this.radius.

#3

@factoradic, It's possible the OP question runs deeper than this, right down to the Circle constructor. It's also possible the OP is not seeing the object instance model that is implicit in this function. Either way, the question begs an answer that is more than mere pointers.

@factoradic, just ribbing you.