I am having a little bit of trouble with build a library exercise in Classes lesson.
I am trying to get step #6 done by “using the reduce method to find the sum of the ratings array & dividing this sum by the length of the ratings array, and return the result”
let ratingsSum = this._ratings.reduce((currentSum, rating) => currentSum + rating, 0);
const lengthOfArray = _ratings.length;
return this.ratingsSum / this.lengthOfArray;
anybody can tell how to fix it?
Many thanks in advance!