I have a problem or I didn't get it. I need to write class Circle and implement following functionality.
1.Properties:center coordinates and radius.
2.Define constructor with parameters for initialize object.
3.Define method, which returns length f circumference(L= 2 * π * R).
4.Define method ,which return copy of current object.
5.Define method which converts current state of object to string and return result.
6.Define static method of circumference for given radius.
Here's my decision and I'm stuck.
function circle(radius)
{
this.radius = radius;
this.area = function ()
{
return Math.PI * this.radius * this.radius;
};
this.perimeter = function ()
{
return 2*Math.PI*this.radius;
};
}
var c = new circle(3);
console.log('Area =', c.area().toFixed(2));
console.log('perimeter =', c.perimeter().toFixed(2));