'this.name' in quickFacts doesn't show up in console, why?

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(value)
    {
      if(typeof value === 'number')
        {
          this._numberOfStudents = value;
        }
      else 
          {
            console.log('Invalid input: numberOfStudents must be set to a Number.');
          }  
    }
    quickFacts()
    {
      console.log(`${this.name}educates ${this.numberOfStudents} students at the ${this.level} school level.`);
    }
  }
class  PrimarySchool extends School
{
  constructor(name,numberOfStudents,pickupPolicy)
  {
    super(name, 'primary',numberOfStudents);
    this._pickupPolicy = pickupPolicy;
  }
  get pickupPolicy(){return this._pickupPolicy;}
}
const LorraineHansbury = new PrimarySchool(PrimarySchool,514,'Students must be picked up by a parent, guardian, or a family member over the age of 13.');
LorraineHansbury.quickFacts();
constructor (name,level,numberOfStudents) // 3 parameters: name, level, numberOfStudents
const LorraineHansbury = new PrimarySchool(PrimarySchool,514,'Students must be picked up by a parent, guardian, or a family member over the age of 13.'); // 3 parameters, but you left out the name

Your PrimarySchool class adds a 4th property, pickupPolicy, but you have to include the name of the school in your assignment of theLorraineHansbury instance of the PrimarySchool class. Hope this helps!

1 Like

Agreed @midlindner that name is not being provided correctly, however the number of parameters provided to the PrimarySchool constructor is correct, as level is being assigned directly in the call to super().

1 Like

Right. Sorry. Instead of passing PrimarySchool as a parameter it should be the name of the school. Good catch. Thanks!

1 Like

Thanks for help, guys! It was so easy but I didn’t realized that cause I was searching for some kind of harder problem )))