School Catalog Project

Hello,
I’m stuck on this syntax error with the Primary School Class; I can’t see what I’m doing wrong. Any light shed on this would be greatly appreciated.

//School=Parent Class//
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 (value.isNaN()) {
    console.log('Invalid input: numberOfStudents must be set to a Number.')
  } else {
    this._numberOfStudents = value;
  } 
}
quickFacts() {
  console.log(`${this.name} educates ${this.numberofStudents} students at the ${this.level} school level.`)
}
static pickSubstituteTeacher(substituteTeachers) {
  const randInt = Math.floor(Math.random() * substituteTeacher.length);
  return substituteTeachers[randInt];
}

//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 sportsTeams() {
    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.');
lorraineHansbury.quickFacts();

const sub = School.pickSubstituteTeacher(['Jamal Crawford', 'Lou Williams', 'J. R. Smith', 'James Harden', 'Jason Terry', 'Manu Ginobli']);

const alSmith = new HighSchool ('Al E. Smith', 415, ['Baseball', 'Basketball', 'Volleyball', 'Track and Field']);


console.log(alSmith.sportsTeams);

Looks like the School class definition has no closing brace.

It’s always something simple, thank you for your help.

1 Like