School Catalogue Project

Hi guys ! First Post on here :wink:
I have a bit of a struggle with this exercice and I don’t understand why… I watched the tutorial and read a few topics but I cant still figuring out. I’d appreciate some advice ! :smiley:
The thing is when I console.log(lorraineHansbury), everything seems fine but I get some undefined on lorraineHansbury.quickFacts().

//                SCHOOL == parent class              //
class School {
  constructor(name, level, numberOfStudents){
    this._name = name;
    this._level = level;
    this._numberOfSutdents = numberOfStudents

  get name() {
    return this._name
  get level() {
    return this._level
  get numberOfStudents() {
    return this._numberOfStudents
  set numberOfStudents(newNumberOfStudents){
    if(newNumberOfStudents.typeOf === 'number'){
      this._numberOfStudents = newNumberOfStudents
    } else {
      console.log('Invalid input: numberOfStudents must be set to a Number.')

    console.log(`${} educates ${this.numberOfStudents} students at the ${this.level} school level.`)

  static pickSubstituteTeacher(substituteTeachers) {
    const randomTeacher = Math.floor(substituteTeachers.length * Math.random());
    return substituteTeachers[randomTeacher];

                          // PRIMARY SCHOOL CLASS // 
class PrimarySchool extends School {
  constructor(name, numberOfStudents, pickupPolicy) {
    super(name,'primary', numberOfStudents);
    this._pickupPolicy = pickupPolicy;

  get pickupPolicy() {
    return this._pickupPolicy

                            // HIGH SCHOOL CLASS //
class HighSchool extends School {
  constructor(name, numberOfStudents, sportsTeams) {
    super(name, 'high', numberOfStudents);
    this._sportsTeams = sportsTeams;
  get sportsTeam() {
    return this._sportsTeams

                      // INSTANCES //
const lorraineHansbury = new PrimarySchool('Lorraine Hansbury', 514, 'Students must be picked up by a parent, guardian, or a family member over the age of 13.');

Hi @tag9358347230
Welcome to the forum!
You already found out that your getter numberOfStudents returns undefined by logging the quick facts. Trace the key back to the constructor of the parent class to find out why it doesn’t get the value…

1 Like

Thank you ! I feel silly haha Guess I spent to much time doing this today, couldnt see the bigger picture anymore… Thx

1 Like