School Catalog Project errors

Why is ${name} undefined on quickFacts method? while I have it set in there?
and an error with this:
School.pickSubstitudeTeacher([‘Jamal Crawford’, ‘Lou Williams’, ‘J. R. Smith’, ‘James Harden’, ‘Jason Terry’, ‘Manu Ginobli’];);

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 numberOfStudent() {
  return this._numberOfStudent;

set numberOfStudent(newNumberOfStudent) {
  if (typeof newNumberOfStudent === number) {
  } else {
    console.log('Invalid input: numberOfStudents must be set to a Number.')

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

static pickSubstitudeTeacher(SubstitudeTeachers) {
 const randInt = Math.floor(SubstitudeTeachers.length * Math.random());
 return SubstitudeTeachers[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() {

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.');


School.pickSubstitudeTeacher(['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']);


The error indicated is on line 65. Remove that internal semi-colon and the parser will recognize the ) that follows it.

I removed it and now it’s giving error on line 29

The error results when we treat variables as globals. Be sure to treat them as instance variables…

1 Like