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 trialEricka Erickson
9,982 Pointsit says my setter method is returning the wrong value
how do i get the right value to return
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 > 60) {
return 'Junior';
} else if (this.credits > 30) {
return 'Sophomore';
} else {
return 'Freshman';
}
}
get major (){
return this._major
}
set major(major){
this._major = major;
if(this.level === 'Senior '|| this.level==='Junior'){
return major;
}else {}
return 'None';
}
}
var student = new Student(3.9, 60);
Steven Parker
229,783 PointsI answered before realizing this is a duplicate, but I've moved my answer to the original question so this one can be deleted (answered questions cannot be deleted).
Bella Bradbury
Front End Web Development Techdegree Graduate 32,790 PointsBella Bradbury
Front End Web Development Techdegree Graduate 32,790 PointsHello Ericka!
This post seems to be a repeat of your previous post on the same issue. I've given a full break down on your other post of what this challenge is and how to adjust your code to better match what's being looked for! You can go ahead and delete this post since it's a duplicate 😁