Classes inheritance IV


#1

why am i getting this error …
am not getting it

/home/ccuser/workspace/learn-javascript-classes-classes-inheritance-iv/main.js:29
nurseOlynk.takeVacationDays();
^

ReferenceError: nurseOlynk is not defined
at Object. (/home/ccuser/workspace/learn-javascript-classes-classes-inheritance-iv/main.js:29:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3

the code is …

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, certifications) {
   super(name);
   this._certifications = certifications;
 } 
}

const nurseOlynyk = new Nurse('Olynyk', ['Trauma','Pediatrics']);

nurseOlynk.takeVacationDays();

please help
thank you


#2

look at this two lines:

const nurseOlynyk = new Nurse('Olynyk', ['Trauma','Pediatrics']);

nurseOlynk.takeVacationDays();

this two variables (nurseOlynk and nurseOlynyk) are not spelled the same way


#3

thanks
i corrected it and the error went away…
but then also it is not accepting it…

why??


#4

can i see a screenshot of the exercise? ensure this screenshot includes the instructions, code, error messages and output

i haven’t had time to do all exercises. I could fix the syntax error you had by just looking at it


#5

I did myself just now …i had to just input 5
thats all
thanks for your help …:slightly_smiling_face:


#6