FAQ: Classes - Inheritance III

This community-built FAQ covers the “Inheritance III” exercise from the lesson “Classes”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Introduction To JavaScript

FAQs on the exercise Inheritance III

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Good afternoon,
At the end of the inheritance III exercise I inserted the following lines to test :

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

I got :
[ ‘Trauma’, ‘Pediatrics’ ]

I am not sure why I got ‘undefined’ when I call the method nurseOlynyk.takeVacationDays(3) ? Can someone explain…thank you

undefined is the absence of a return value

takeVacationDays doesn’t return anything, so why bother logging?


thank you, I just go it…



Do everybody get this error?
Codecademy accepts my code, but in console:

ReferenceError: remainingVacationDays is not defined
at new Nurse


Please post your full code

I already understood it.
I put this too:


in the next lesson they clarified it, that methodes get inherited automatically.

1 Like

I don’t know if it’s an attempt at being more inclusive of other cultures, or just plain oversight, but naming the nurse “Olynyk” is a terrible idea for anyone unfamiliar with the name, or just not incredibly great at spelling.

When you’re trying to learn a new topic, especially one as complicated as inheritance in programming, throwing errors in the lesson simply because the name of the nurse, is bad design. It’s bad enough the name even matters, but making it “Olynyk” (notice that second “y”), makes things more complicated than they need to be. I don’t care if the name is “Brian”, “Matt”, “Laura”, “Cino”, etc, but make it something simpler, cleaner, not something complex and prone to error. What may seem incredibly minor to some, could be a headache and time lost for someone else - note, this was not the case for me (I noticed that second “y” within seconds), I’m simply bringing it up. This is NOT the first lesson a typo has produced an error, in a place where it just isn’t needed.


Unorthodox names do occur, while working under codecademy i always recommend copying strings provided by the instructions to prevent this kind of error

unfortunately, small typos can cost lot of time, its impossible to eliminate. They can even occur in method/function names, that can also cost a lot of time.


I was wondering if the reason why the values passed on to Nurse are only name and certificates because the Vacation Days Off are going to be the same for all hospital employees.

1 Like

yes, all hospital employees have the same amount of days off (in total, in a more real world application this would probably on yearly basics. )

If you wanted to return the remaining vacation days, you would do the following:

1 Like

Yes probably but Basketball fans love Codecademy references only them can understand.


I’m getting the following message on step 5 of this section:

Did you create a new Nurse instance named nurseOlynyk and set its name and certifications to the values in the task to the left?
class Nurse extends HospitalEmployee {
  constructor(name, certifications) {
    this._remainingVacationDays = 20;
    this._certifications = certifications;

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

Step 5 is…

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']

I’ve copied and pasted the name and certifications just to be sure as well as the constant variable name.

I’m currently unsure whether I’m going insane or there’s something wrong…somewhere.


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

"['Trauma', 'Pediatrics']" is a string. Why?

Because dumb :slight_smile:

However that didn’t fix it.

On a whim, I changed the double quotes around the name Olynyk to single quotes and it works. Either are valid AFAIK and it’s never caused me any problems before :confused:

1 Like

I would need to see the full code to diagnose that problem.

its always good to understand why a certain change affects your code

Same here.

class Nurse extends HospitalEmployee {
    this._certifications = certifications;

Doesn’t work:

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


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

I have same problem.

I’d say the opposite : Codecademy loves BasketBall. Both Durant and Curry from the previous exercice are BBall player. I’ve also noticed other references to playing position and players first names in other exercice. Since i’m an NBA fan too it’s always pleasing to use such examples.

1 Like