JavaScript Object-Oriented JavaScript Getters and Setters Creating Getter Methods

what is wrong with this code? challenge 2 of 2 - Getter methods in Object-Oriendted JS

getting an error that 'your condition is returning wrong value'.

creating_getters.js
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 && this.credits <= 90) {
        return 'Junior';
      } 
     else if(this.credits >= 31 && this.credtis <= 60) {
        return 'Sophomore';
      } 
     else {
        return 'Freshman';
      }
    }
}

const student = new Student(3.9);

2 Answers

Antti Lylander
Antti Lylander
9,659 Points
else if(this.credits >= 31 && this.credtis <= 60) //you have misspelled credits

oops...thank you, Antti!