Hey y’all first happy thanksgiving!
I’m working on Functional programming exercises specifically this one: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data
and below is my answer:
var averageRating = watchList.map(movie => Number(movie.imdbRating))
.reduce((accum, value) => accum += value, 0) / watchList.length;
Even when I average these by hand I get the same result as my JS (8.52) but I don’t understand for the life of me why the test output is:
// running tests
The averageRating should equal 8.675.
// tests completed
Is this a bug or am I missing something?
Thanks in advance!!!