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 trialDaniel Kolb
10,172 PointsI can't seem to get the right answer here. any help?
class Student {
constructor(gpa, credits){
this.gpa = gpa;
this.credits = credits;
}
stringGPA() {
return this.gpa.toString();
}
get level() {
const credits = this.credits;
if (credits > 90) {
return 'Senior';
} else if (credits >= 61) {
return 'Junior';
} else if (credits >= 31) {
return 'Sophmore';
} else {
return 'Freshman';
}
}
}
const student = new Student(3.9, 50);
console.log(student.level);
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHI Daniel Kolb
You do have it!! :) You simply have a spelling error in one the the levels.
You have "Sophmore" that is missing an "o" — Just correct the spelling to "Sophomore" and it will pass.
It'd be good to remember that code challenges are very strict and very picky. One spelling error or a missing punctuation mark, or anything else that is not specified in the instructions will result in a "Bummer!" message even if the code is correct.
Keep coding! :)
Steven Parker
231,172 PointsSteven Parker
231,172 PointsI would add that programming in general is "very picky". A misspelled variable name or comparison value will almost always prevent code from working as intended.
But the challenges are indeed picky about other aspects of the conditions given in the instructions, like the contents of displayed strings which would cause no errors in actual practice.