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; } } const surgeonRomero = new Surgeon('Francisco Romero', 'Cardiovascular'); const surgeonJackson = new Surgeon('Ruth Jackson', 'Orthopedics');
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