JavaScript Object-Oriented JavaScript Getters and Setters Creating Getter Methods

Lauren Pinckney
PRO
Lauren Pinckney
Pro Student 7,229 Points

Can't find error. "Your conditional statement is returning the wrong student level."

Not sure why my conditionals aren't passing...

creating_getters.js
class Student {
    constructor(gpa, credits){
        this.gpa = gpa;
        this.credits = credits;
    }

    get level(){
      if(this.credits > 90){
        return 'Senior';
      }else if(this.credits >= 61 && this.credits <= 90) {
        return 'Junior';
      }else if(this.credits >= 31 && this.credits <= 60) {
        return 'Sophmore';
      }else if(this.credits < 31) {
        return 'Freshman';
      }

    }

    stringGPA() {
        return this.gpa.toString();
    }
}

const student = new Student(3.9);

2 Answers

You just made a typo, you should return "Sophomore" not "Sophmore" :)