Methods 4/12


Hello, guys, need help :slight_smile:

class Surgeon {
constructor(name, department) {
this._name = name;
this._department = department;
this._remainingVacationDays = 20;

get name(){
return this._name;

get department(){
return this._department;

get remainingVacationDays(){
return this._remainingVacationDays;

takeVacationDays(daysOff) {
this._remainingVacationDays - daysOff; // can’t understand what do they want from me
6. Under the remainingVacationDays getter, create a method called takeVacationDays that accepts one argument named daysOff.

Inside of the method, subtract daysOff from the number saved to _remainingVacationDays. Set _remainingVacationDays to the result. <- What does it mean??

const surgeonCurry = new Surgeon(‘Curry’, ‘Cardiovascular’);
const surgeonDurant = new Surgeon(‘Durant’, ‘Orthopedics’);


we need to update remainingVacationDays variable, so we know how many vacationDays employees have left.


ok, so what do a i need to change in my scrypt or prepend?



this._remainingVacationDays - daysOff;

you calculate how many vacation days an employee has left after taking some days off, but you do nothing with the result of this subtraction, you need to store this in a variable


I did it. Watch the scrypt please


Hey, I also stuck somehow at the same thing. Mainly I saw the difference between

this._remainingVacationDays - daysOff; // which also was my answer and wondering why it was wrong.

and the correct answer:

this._remainingVacationDays -= daysOff;

Can someone explain me why ’ - ’ is wrong and why we need ’ -= ', because I can’t remember another modul was teaching me that so I was very confused.


because x -= y --> x = x - y

in russian, because i’m from Ukraine;)


-= is a shorthand, without the shorthand it would be:

this._remainingVacationDays = this._remainingVacationDays - daysOff;

it will update/re-assign the variable, doing this._remainingVacationDays - daysOff; gives you the subtraction, but you do nothing with the result of the subtraction.


Thanks, figured it out.)