School Catalog Project - string instead of number not triggering console log error


I know this is something silly, but I need another set of eyes.

Here’s my code so far:

This returns:

Lorraine Hansbury educates George students at the primary school level.

It should return:

Lorraine Hansbury educates That is Not a Number! students at the primary school level.

and there should be a log in the console, which there is not.

Why is this conditional not working as expected?

When you’re defining the numberOfStudents property for the lorraineHansbury primary school object you created, the second parameter is the numberOfStudents, but you set it to ‘George’.

Moreover, you made it so that when the numberOfStudents provided as a parameter is not a number, it sets the numberOfStudents for that object to a number. But you’d probably want to just log an error in such a case.

That… was intentional? It should reflect ‘That’s not a number’ when a string, like ‘George’, is added. I was testing to make sure it worked. It does not.

Fixed it. Removed the call for the numberOfStudents in the Primary class, and the underscores in the getters for School.
New code here: