Learn JavaScript: Classes ; Inheritance III ; Under the Nurse class, create a new instance of Nurse and save it to a constant variable named nurseOlynyk. Pass in the following values for each property:


#1

Inheritance III
5. Under the Nurse class, create a new instance of Nurse and save it to a constant variable named nurseOlynyk. Pass in the following values for each property:

name: 'Olynyk'
certifications: ['Trauma', 'Pediatrics']

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;
}
}

class Nurse extends HospitalEmployee {
constructor(name,remainingVacationDays,certifications ) {
super (name, remainingVacationDays)
this._name = name;
this._remainingVacationDays = remainingVacationDays;
this._certifications = certifications;

}

}

const nurseOlynk = new Nurse (‘Olynk’, certifications ‘Trauma’,'Pediatrics);

                                                  console.log( nurseOlynk._name);

how do I pass in the certifications values to my new nurseOlynik variable? i cant seem to get it


#2
const nurseOlnyk = new Nurse('Olynyk', ['Trauma', 'Pediatrics']);

The second parameter is a list that gets assigned to the certifications property.


#3

beware, it misses the “y” in “const nurseOlynyk”
:wink:
:eyeglasses: