33/33 what more should i do?


#1
function Circle (radius) {
this.radius = radius;
this.area = function () {
    return Math.PI * this.radius * this.radius;

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

};

i don´t understand what´s wrong with this code...can somebody help me pass 33/33?


#2

Hi, there is a space between this and perimeter.


#3

haha...hate when that happens...thank you!


#4

Out of curiosity, can someone tell me why when i do this:

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

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

it console logs a series of numbers, those being as followed :

6.283185307179586
12.566370614359172
18.84955592153876
25.132741228718345
31.41592653589793
37.69911184307752
43.982297150257104
50.26548245743669
56.548667764616276


#5

**

just this

**

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

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

};


#6

Wow... You multiplied PI with 2, then added that repeatedly


#7

can you tell me how that happened? How to break out of it?


#8

I'm guessing that since you put the same thing on console.log, and you return it, so it may have made it go over and over again, but since the browser doesn't crash, I'm guessing it's not the complete case. But you know, it's a pointer :smile:.

You can take that all out by taking out your console.log statement.

:smile::smile::smile::smile::smile::smile::smile:


#9

I'm pretty sure its just codecademy verifying it 9 times lol.