Hey all. I am just working through the Javascript Syntax Part III - Build a Library Exercise but cannot figure out the error in the message below.
Javascript Syntax Part III - Build a Library
https://www.codecademy.com/paths/full-stack-engineer-career-path/tracks/fscp-22-javascript-syntax-part-iii/modules/wdcp-22-learn-javascript-syntax-classes/projects/build-a-library
/home/ccuser/workspace/learn-javascript-classes-build-a-library/app.js:48
super(title);
^
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)
class Media { //Start of Media Class Declaration
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;
}
isCheckedOut(state) {
this._isCheckedOut = state;
}
toggleCheckOutStatus() {
if (this._isCheckedOut === true) {
this._isCheckedOut = false;
} else {
this.isCheckedOut = true;
}
}
getAverageRating() {
const count = this._ratings.length;
let sum = 0;
for(let i=count-1; i>=0; i--) {
sum += this._ratings[i];
}
return sum/count;
}
addRating(rating) {
this._ratings.push(rating);
}
} //End of Media Class Declaration
// Start of Book Class Declarations
class Book extends Media(author, title, pages){
super(title);
this._author = author;
this._pages = pages;
get author() {
return this._author;
}
get pages() {
return this._pages;
}
} //End of Book Class Declarations
//Start of Movie Class Declarations
class Movie extends Media(director, title, runTime) {
super(title);
this._director = director;
this._runTime = runTime;
get director() {
return this._director;
}
get runTime() {
return this._runTime;
}
} //End of Movie Class Declarations
//New Book A Short History of Nearly Everything
const historyOfEverything = new Book('Bill Bryson', 'A Short History of Nearly Everything', 544);
historyOfEverything.toggleCheckOutStatus();
console.log(historyOfEverything.isCheckedOut);
historyOfEverything.addRating(4);
historyOfEverything.addRating(5);
historyOfEverything.addRating(5);
console.log(historyOfEverything.getAverageRating());
//New Movie Speed
const speed = new Movie('Jan de Bont', 'Speed', 116);
speed.toggleCheckoutStatus();
console.log(speed.isCheckedOut);
speed.addRating(1);
speed.addRating(1);
speed.addRating(5);
console.log(speed.getAverageRating());