Javascript Project School Catalogue: Step 16

In the javascript project School Catalog, I am stuck on Step 16. I have made a static function but when I call on it, the error says the parameter is undefined. The link to the project is here:
This is my error:
const num = Math.floor(Math.random() * substitueTeachers.length);

ReferenceError: substitueTeachers is not defined
at Function.pickSubstituteTeacher (/home/ccuser/workspace/learn-javascript-classes-school-catalog/app.js:28:44)
at Object. (/home/ccuser/workspace/learn-javascript-classes-school-catalog/app.js:57:20)
at Module._compile (module.js:571:32)
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)

This is my code:

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(numberOfStudents){
    if (typeof this.numberOfStudents == 'number'){
      this._numberOfStudents = numberOfStudents;
    else {
      console.log('Invalid input: numberOfStudents must be set to a number.');
  quickFacts (){
    console.log(`${} educates ${this.numberOfStudents} students at the ${this.level} school level`);
  static pickSubstituteTeacher(substituteTeachers) {
    const num = Math.floor(Math.random() * substitueTeachers.length);
    return substituteTeachers[num];

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){
    this._sportsTeams = sportsTeams;
  get sportsTeams(){
    return this._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.');


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

Please help!

Hey @versus7 :grinning:

Assuming this is all of your code, your problem may be hiding in plain site, check your spelling of substituteTeachers on line 27 versus line 28.

1 Like

Thanks a lot 8-bitgaming, that fixed my problem!
The little things do matter.

1 Like

Your welcome :grinning: Everyone has this happen to them at some point in time.

Yes indeed, I have searched through code for half an hour trying to find an elusive bug, only to find that one word was misspelled. :slight_smile:


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