Hi. I got the maximal code stack whatever error on this code. I can’t see what is wrong. It’s the javascript classes exercise named “Build a library” class Media {
constructor (title) {
this._title = title;
this._isCheckedOut = false;
this._ratings = [];
}
get title () {
return this.title;
}
get _isCheckedOut () {
return this._isCheckedOut;
}
get ratings () {
return this.ratings;
}
toggleCheckOutStatus () {
this._isCheckedOut = !this._isCheckedOut;
return _isCheckedOut;
}
get AverageRating () {
let arraySum = function arr () {
this._ratings.reduce (function (a,b) {
return a + b;},o);
}
let arrayAverage = arraySum/this._ratings.length;
return arrayAverage;
}
addRating (newRating) {
this._ratings.push(newRating);
}
set _isCheckedOut (newValue) {
if ( this._isCheckedOut == newValue) {
return true;
} else
{
_isCheckedOut = newValue;
}
}
}
class Book extends Media {
constructor (author, title, pages) {
super (title);
super (_isCheckedOut);
super (ratings);
this._author = author;
this._pages = pages;
}
get author () {
return author;
}
get pages () {
return pages;
}
}
class Movies extends Media {
constructor (director, title, runTime) {
super (title);
super (isCheckedOut);
super (ratings);
this._runtime = runTime;
this._director = director;
}
}
const historyOfEverything = new Book (‘Bill Bryson’, ‘A Short History of Nearly Everything’, 544 );
historyOfEverything.toggleCheckOutStatus ();
console.log(historyOfEverything.isCheckedOut);