class HospitalEmployee { constructor(name) { this._name = name; this._remainingVacationDays = 20; } get name() { return this._name; } get remainingVacationDays() { return this._remainingVacationDays; } takeVacationDays(daysOff) { this._remainingVacationDays -= daysOff; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter