# Methods

#1

I need help with this exercise i don't understand good

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

};

// define a perimeter method here
}

};``````

Define a method perimeter that calculates the perimeter of a circle.

#2

look at your area method, it has very different (and the right) syntax. Please correct your perimeter method using the area method as blue print

#3

this.area = function () {

``};``

}
// define a perimeter method here
this.area = function () {

``};``

}
i make mi code again ,it's correct or not?
because i have the confution with the relation

#4

what did you do? i said that the syntax of your perimeter method was incorrect, and you should look at the area method for correct syntax, and you did something completely different?

#5

and this, sorry im very very bad with this

this.area = function () {

``};``

}
// define a perimeter method here
this.area = function () {

``````};
};
perimeter(4)``````

#6

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

};

// define a perimeter method here
}

};``````

Everything was fine until I saw this --

``````// define a perimeter method here
}``````

Lets read what the problem says us to do..

Define a method perimeter that calculates the perimeter of a circle.

When we add a method to a constructor we use this keyword and attach (dot notation) with methods name ( same as variables) .

suppose if this constructor needs a method that returns name of coder who wrote it.
I'd write something like this.

``````// define a method that gives coders name
this.coder = function(){
return "santiago.rodriguez"
}``````

Do you get the hint?
I hope it helps!!

#7

omg i understand a lot with your help thanks you at the end this is my code,and the moderator doesn't explain me but if your don't help me .i can't resolve this thank you very much

this.area = function () {

``````};
this.perimeter = function () {

};
console.log(this.perimeter(1))
// define a perimeter method here``````

};

#8

Youre welcome!
Actually, Because of Mod I was able to see this thread (post).
Kudos to mod and I'm glad it worked !

#9

ok thanks mod jajaja

#10

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