Question about Getters

get name() {
return this._name

get department() {
return this._department

get remainingVacationDays() {
return this._remainingVacationDays

takeVacationDays(daysOff) {
this._remainingVacationDays -= daysOff;


This is a bit of code taught in Javascript Syntax 3.
takeVacationDays(daysOff) is a method that appears to alter remainingVacationDays. But it seems like the lesson is also telling me that anything prepended with an underscore should be left alone. It’s very confusing, as such I don’t have a specific question. Can someone help make sense of this for me?

Getters and Setters are used for the public interface to your class. Inside the class, you can use the ‘private’ variables within other functions.