In school catalogue, why is there an error even when I code the same as the guide?

This is my code, the same as the guide, but there is an error when I run it.
This is the linkSchool Catalogue

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(input){
    if(typeof input === 'number'){
     return this._numberOfStudents = input
    } else {
     console.log('Invalid input: numberOfStudents must be set to a Number.')
    }
  }

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

 static pickSubstituteTeacher(substituteTeachers){
const options = [substituteTeachers];
let index = Math.floor(Math.random() * options.length);
return options[index];
 }
}

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

  get pickupPolicy(){
    return this._pickupPolicy;
  }
}

class HighSchool extends School {
  constructor(name, numberOfStudents, sportsTeams){
    super(name,);
    super('high');
    super(numberOfStudents);
    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.');

lorraineHansbury.quickFacts();

the error is shown below:
/home/ccuser/workspace/learn-javascript-classes-school-catalog/app.js:54
super(name,);
^
SyntaxError: Unexpected token )
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)

I do not know what is going wrong.
could you please help me? Thanks

although the error might look intimidating, its actually really helpful

lets take a look:

super(name,);

you have a comma, which separates arguments. So either: add another argument or remove the comma

also, why do you have 3 super calls? super() call the parent method, why would you want to do this multiple times? You can just call the parent constructor once and provide all the arguments needed for the parameters, just like you would do with any other function or method call.

1 Like

get it, thank you so much.

1 Like