Build a Library - NaN


I am working through the build a Library Excercise in the Intro to JS course. I’m attempting to do this freehand without following the guidance as suggested for a bit of a challenge.

I am just getting started and doing a bit of checking on my parent class:

My code:

//parent class
class Media {
//parent class constructor
constructor(title) {
this._title = title;
this._ratings = [2,4];
this._isCheckedOut = false;
this._averageRating = 0
get title() {return this._title}
get ratings() {return this._ratings;}
get isCheckedOut() {return this._isCheckedOut}
this._averageRating = this._ratings.reduce/this._ratings.length
const bonJovi = new Media(‘Livin’ on a prayer’)

the output i get to the console is NaN.

I dont see anywhere that would output anything that isnt a number.

can anyone explain where im going wrong?


Best advice… Take advantage of the guidance. It’s too early to go it alone. Sure the challenge is cool, but your time will be better spent following instructions and using the walk through video.

Check the documentation for Array.reduce(). What you have there is incorrect.