Help with Inheritance IV! Odd error but I passed..?

So I’m not sure where I went wrong because going through the Inheritance courses, I havent had an error code until Inheritance IV, I was able to pass the course with the error code but I want to make sure I’ve done everything correctly.

  constructor(name) {
    this._name = name;
    this._remainingVacationDays = 20;
  }
  
  get name() {
    return this._name;
  }
  
  get remainingVacationDays() {
    return this._remainingVacationDays;
  }
  
  takeVacationDays(daysOff) {
    this.remainingVacationDays -= daysOff;
  }
};

class Nurse extends HospitalEmployee {
 constructor(name, certifications) {
   super(name);
   this._certifications = certifications;
 } 
}

const nurseOlynyk = new Nurse('Olynyk', ['Trauma','Pediatrics']);

console.log(nurseOlynyk.takeVacationDays(5));
console.log(nurseOlynyk.remainingVacationDays)```

Heres the link as well:
https://gist.github.com/codecademydev/2e8dd83369a7a29582f6629fd071d957

The error is telling me that on line 16 ``-=`` cannot set the ``-`` property. I'm not sure where I went wrong so any help or pointers is appreciated!

You have a getter but no setter for remaining vacation days. So when you do this.remainingVacationDays -= when it tries to do the = part it cannot because there is no setter method for it to call to update the value of the property.

1 Like

Got it! Thank you :slight_smile:

1 Like