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 trialYeukai Patience Shiripinda
8,067 PointsI dont understand why my conditional statement is wrong .please help!!
Id like some assistance with this as i am not understanding where i am getting it wrong.Please help!!
class Student {
constructor(gpa, credits){
this.gpa = gpa;
this.credits = credits;
}
get level(){
if (this.credit > 90) {
return "Senior";
}else if(this.credit >= 61) {
return "Junior";
} else if(this.credit >= 31) {
return "Sophomore";
}else{
return "Freshman";
}
}
stringGPA() {
return this.gpa.toString();
}
}
const student = new Student(3.9);
2 Answers
Cameron Childres
11,820 PointsHi Yeukai,
Your logic looks great! The only issue I'm seeing is that you're missing an 's' on the end of 'credits' inside your conditional statements. Change these from 'credit' to 'credits' so they match with what's defined at the top and you should be good to go.
Yeukai Patience Shiripinda
8,067 PointsOh my goodness you are totally right !Thanks a bunch Cameron Childres