School Catalog

Help, please.

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(newNumberOfStudents) {

    if (newNumberOfStudents.isNAN()) {

      console.log('Invalid input: numberOfStudents must be set to a Number.');

    } else {

      this._numberOfStudents = newNumberOfStudents;

    }  

  }

  quickFacts() {

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

  }

  static pickSubstituteTeacher(substituteTeachers) {

     const randInt = Math.floor(Math.random() * substituteTeachers.length);

     return substituteTeachers[randInt];

  }

  class PrimarySchool extends School {

      constructor(name, numberOfStudents, pickupPolicy) {

        super(name, 'Primary', numberOfStudents);

        this._pickupPolicy = pickupPolicy;

      }

      get pickupPolicy() {

       return this._pickupPolicy;

      }

  }

  

  class HighSchool extends School {

    constructor(name, numberOfStudents, sportsTeams) {

      super(name, 'High', numberOfStudents);

      this._sportsTeams = sportsTeams;

    }

    get sportsTeams() {

      return this._sportsTeams;

    }

  }

/home/ccuser/workspace/learn-javascript-classes-school-catalog/app.js:30
class PrimarySchool extends School {
^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)

Letter case matters. .isNaN.

The line above line 30 should have a closing brace for the School class.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.