Error in Build a Library project in back end career path

Hi, I am receiving error when running this code, but I could not find the bug and fix it. Below is my code and the error it shows

MY CODE :

ERROR :

/home/ccuser/workspace/learn-javascript-classes-build-a-library/app.js:31
});
^
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)

Does the Media class have a closing bracket?

I would also add a couple of parenthesis in this line and play around with it… something looks like it’s missing (try commenting it out and see if it runs without it…

getAverageRating() {
    return this.ratings.reduce(
       (currentSum, rating) => ((currentSum + rating) / this.ratings.length)
    );
  }
1 Like

Thank you so much for pointing out the mistake. There was no closing bracket for the Media class. I added it, now it works. Thank you very much. :smile:

1 Like