Scholl Catalogue, setter not working


Hi everyone,

I am struggling with the setter in the school catalogue exercise.
I understand how it works I think but I cannot figure out why it does not work.

As you can see I put a numberOfStudents != number on purpose in the end, but the console does not log anything even if I set the numberOfStudents as a string.

class School {
  constructor(name, level, numberOfStudents){
    this._name = name;
    this._level = level;
    this._numberOfStudents = numberOfStudents;

  get name(){
    return this._name;

  get level(){
    return this._level;

  get numberOfStudents(){
    return this._numberOfStudents;

  set numberOfStudents(NumberOfStudentsIn){
    this._numberOfStudents = NumberOfStudentsIn;
   if(typeof NumberOfStudentsIn === 'Number'){
      this._numberOfStudents = NumberOfStudentsIn;
    } else {
      console.log(`Invalid input: ${this._numberOfStudents} must be set to a Number.` );

const cClaudel = new School('test name', 'test level, 'rer');

I passed this:
cClaudel.numberOfStudents = ‘rer’;

and the setter worked! why doesn’t it work when I entered my variable?


It would make better sense if the user’s input was shown here…

`Invalid input: ${numberOfStudents} must be set to a Number.`