School catalogue project, correct results but random "undefined" showing up

Hi, I’ve just completed the School Catalogue project in the Classes topic of JavaScript.
I’m getting correct output when i console log things in my code, but each output has an “undefined” tacked on the end.
Could someone tell me what I am missing, I cant find it myself!

Here is my code:

[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;

quickFacts() {
console.log(${this._name} educates ${this._numberOfStudents} students at the ${this._level} school level.)

static pickSubstituteTeacher(substituteTeachers) {
const rand = Math.floor(Math.random()*(substituteTeachers.length - 1));
return substituteTeachers[rand];

set numberOfStudents(numberOfStudents) {
if (typeof numberOfStudents === “number”) {
this._numberOfStudents = numberOfStudents;
} else {
console.log(“Invalid input: numberOfStudents must be set to a Number”);

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

get pickupPolicy() {
return this._pickupPolicy;

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


console.log(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’]);


And here is the output to my 3x console.logs:

[color=blue]Lorraine Hansbury educates 514 students at the primary school level.
Lou Williams
[ ‘Baseball’, ‘Basketball’, ‘Volleyball’, ‘Track and Field’ ]


Hello @ojan25, welcome to the forums! The problem is here:

Your quickFacts console.log()s a value, but here:

You also use console.log(). However, quickFacts returns nothing-so JS automatically gives it a return value of undefined-which is why that is also printed.

I hope this helps!