Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialUbaid Eusufzai
Courses Plus Student 9,621 PointsEven after reading the solution, it failed
I have read all discussions and tried everything I could think of, still failed. copying the answer directly doesn't help either. I am so close to quit learning javaScript!!!
someone please post the solution here, I don't want any hints anymore.
class Circle {
set radius(radius) {
this._radius = radius;
this.area = 3.14 * Math.pow(radius, 2);
this.circumference = 2 * 3.14 * radius;
get radius(){
return this._radius;
}
}
}
const circ = new Circle();
2 Answers
jb30
44,806 Pointsclass Circle {
set radius(radius) {
this._radius = radius;
this.area = 3.14 * Math.pow(radius, 2);
this.circumference = 2 * 3.14 * radius;
}
get radius(){
return this._radius;
}
}
const circ = new Circle();
You had your get radius()
method inside your set radius(radius)
method.
Ubaid Eusufzai
Courses Plus Student 9,621 Pointsthank you so much. it worked!