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 trialWilliam Domenech
7,259 Pointsi dont know whats wrong here
i feel like i am missing something simple
class Student {
constructor(gpa, credits){
this.gpa = gpa;
this.credits = credits;
}
get level(){
if(this.credits < 90){
return 'Senior';
} else if (this.credits >= 61){
return 'Junior';
} else if (this.credits >= 31){
return 'Sophomore';
} else (){
return 'Freshman';
}
}
stringGPA() {
return this.gpa.toString();
}
}
const student = new Student(3.9);
1 Answer
devvoyage
Front End Web Development Techdegree Student 15,200 PointsHi, William Domenech!
You are doing fantastic, so don't give up quite yet! There are just a couple of minor errors.
First, there's a syntax error at the else
that returns Freshman
. You have a pair of parentheses after the else
. It should look like this:
} else { // I removed the parentheses here
return 'Freshman';
}
The second is a logic error. You're returning "Senior"
when they have less than 90 credits, but you should be returning "Senior"
when they have more than 90 credits. Switching the <
to a >
will fix that.
Hope this helps!
William Domenech
7,259 PointsWilliam Domenech
7,259 Pointsi knew it had to be something minor thanks so much!