Build a Library. SyntaxError: 'super' keyword unexpected here

Hi!
I have a problem with my code for Build a Library project
This is my code:

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;
  }
  set isCheckedOut(toggle) {
    this._isCheckedOut = toggle;
  }
  toggleCheckOutStatus() {
  	this._isCheckedOut = !this._isCheckedOut;
    }
  }
  getAverageRating() {
    let ratingSum = this.ratings.reduce(function (acc, cur) {
     return (acc + cur);
    })
    return ratingSum / ratings.length
  }
  addRating(newRating) {
    this.ratings.push(newRating);
  }
}
class Book extends Media {
  constuctor(title, author, pages) {
    super(title);
    this._author = author;
    this._pages = pages;
  }
  get author() {
    return this._author;
  }
  get pages() {
    return this._pages;
  }
}
class Movie extends Media {
  constructor (direcor, title, runtime) {
    super(title);
    this._director = director;
    this._runTime = runTime;
  }
  get director() {
    return this._director;
  }
  get runTime() {
    return this._runTime;
  } 
}
const historyOfEverything = new Book ('A Short History of Nearly Everything', 'Bill Bryson', 544);

And it returns this error:

SyntaxError: 'super' keyword unexpected here

What am I doing wrong?

here:

class Book extends Media {
  constuctor(title, author, pages) {

you made a typo in constructor, as such, its not recognized and doesn’t know how to handle super

1 Like

Thanks @stetim94!
I was so sure I checked the syntax…

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.