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 trialAmy Tomey
12,847 PointsFrustrated... even when I copied and pasted the solution for # 1... I got an error. Bummer: Unexpected identifier
I had tried everything, so out of desperation, I copied and pasted the solution for Challenge 1. and I got the same error... Bummer: Unexpected identifier. THIS is why I'm not sure I'm gonna make it... there's a problem and I can't find it.
class Rectangle {
constructor(width, length){
this.width = width;
this.length = length;
}
}
get area() {
return this.width * this.length;
}
const rect1 = new Rectangle(10, 5);
const rect2 = new Rectangle(6, 12);
const rect3 = new Rectangle(15, 20);
2 Answers
Joseph Yhu
PHP Development Techdegree Graduate 48,638 PointsThe getter method should be inside the class.
Amy Tomey
12,847 Pointsfound the problem.... thanks for looking!
Amy Tomey
12,847 PointsAmy Tomey
12,847 Pointsso... I did this:
AND
Same error.