Can't find what I am doing wrong

I think that the result should be 8,52, however FCC says that it should be 8,675.
Can someone help me figure what did I do wrong? Thanks!
My code

function getRating(watchList) {

  let imdbRating = watchList.map(value => value["imdbRating"]);

  let ratingNum = imdbRating.map(function (item) {

    return parseFloat(item)

  })

  let divider = ratingNum.length;

  let overallRating = ratingNum.reduce((acc, currentValue) => {

   return acc + currentValue;

  }, 0.0)

  let averageRating = overallRating / divider

  return averageRating;

}

console.log(getRating(watchList));

Link to the challenge:

The instructions say, "… of the movies directed by Christopher Nolan" Are you accounting for that?

1 Like

Oh my bad. I actually didn’t do anything for that since I thought all of them were directed by him. Thanks man.

1 Like

I’m pretty sure I missed that when I did this the first time. Part of being a developer is paying close attention to tiny details.

While I’m here, I would also point out that you could combine your two map methods. I mean, they can work separately, but would be more efficient combined.

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