Javascript methods

Hello everyone;
I have a question related to the method in JS classes in the exercise link down;
why does console.log(surgeonJackson.takeVacationDays(5)); returns undefined even though there was a created a method with the name of takeVacationDays() ?

Please do always also post the code your questions is related to.

According to the instructions, that method is not supposed to return a value, but change the value of _remainingVacationDays.

If you also have the getter remainingVacationDays and you log surgeonJackson.remainingVacationDays. before and after you called takeVacationDays, you should see that the amount of days left has changed.

1 Like