code is as follows. While learning the class usage of es6, an error occurred when calling the getter method
console.log(c.radius());//getter
^
TypeError: c.radius is not a function
how do I use that? How does everyone use it?
class Circle {
constructor(radius) {
this._radius = radius;
Circle.circlesMadePP;
};
static draw(circle, canvas) {
// Canvas
};
static get circlesMade() {
return !this._count ? 0 : this._count;
};
static set circlesMade(val) {
this._count = val;
};
area() {
return Math.pow(this.radius, 2) * Math.PI;
};
get radius() {
return this._radius;
};
set radius(radius) {
if (!Number.isInteger(radius))
throw new Error("");
this._radius = radius;
};
}
let c=new Circle(5);//
Circle.draw(c,6);//
console.log(c.radius());//getter
console.log(c.area());//