Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created April 11, 2019 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/cbcac721b048f20c2e446de5bfed9770 to your computer and use it in GitHub Desktop.
Save codecademydev/cbcac721b048f20c2e446de5bfed9770 to your computer and use it in GitHub Desktop.
Codecademy export
class Surgeon {
constructor(name, department) {
this._name = name;
this._department = department;
this._remainingVacationDays = 20;
}
get name() {
return this._name = name;
}
get department() {
return this._department;
}
get remainingVacationDays() {
return this._remainingVacationDays;
}
takeVacationDays(daysOff) {
this._remainingVacationDays -= daysOff;
}
}
const surgeonCurry = new Surgeon('Curry', 'Cardiovascular');
const surgeonDurant = new Surgeon('Durant', 'Orthopedics');
console.log(surgeonCurry.name());
surgeonCurry.takeVacationDays(3);
console.log(surgeonCurry.remainingVacationDays());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment