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 trialLucciano Molina
7,332 PointsThe getter method should return the level of a student, based on how many credits (this.credits) they have.
I looked at some of the other answers regarding this question but can't seem to figure out what's wrong with my code. I think I just don't have an eye for those small details yet. Any help would be greatly appreciated. Thank you
class Student {
constructor(gpa, credits){
this.gpa = gpa;
this.credits = credits;
}
stringGPA() {
return this.gpa.toString();
}
get level () {
if (this.credits > 90){
return 'Senior';
}else if(this.credits >= 61){
return 'Junior';
}else if(this.credits >=31){
return 'Sophmore';
}else {
return 'Freshmen';
}
}
}
const student = new Student(3.9);
2 Answers
Ella Ruokokoski
20,881 PointsHi! Your code is correct but you have mistyped "Sophomore" and "Freshman" :)
Lucciano Molina
7,332 PointsThank you Ella, I caught that and passed the challenge. I appreciate you taking the time to help me out!