Command chaining bug in Functional Programming section/ possible incorrect solution?

Hello All. This is kind of directed at the FCC team as I may have run into a bug that might affect the user experience. In the functional programming section, there were a few times I used chained commands.
When I submitted, the tests showed that I had passed every facet of the challenge, except the one that said “solution must use reduce() method.”
(I believe in the other instance of this bug, it was the map() method.). Except I had used reduce, and had gotten the answer correct.
So I believe this might be a bug. When I changed to just use subsequent commands, the solution worked, but I believe even the answer provided by FCC might not work as it uses chained commands.

The other possible issue I saw was in the first solutuon to the “Use the reduce Method to Analyze Data”. The solution I am referring to is

function getRating(watchList){
  // Add your code below this line
  var averageRating =
  watchList
    // Use filter to find films directed by Christopher Nolan
    .filter(film => film.Director === "Christopher Nolan")
    // Use map to convert their ratings from strings to numbers
    .map(film => Number(film.imdbRating))
    // Use reduce to add together their ratings
    .reduce((sumOfRatings, rating) => sumOfRatings + rating) /
  // Divide by the number of Nolan films to get the average rating
  watchList.filter(film => film.Director === "Christopher Nolan").length;
  // Add your code above this line
  return averageRating;
}
console.log(getRating(watchList));

I am not sure if “rating” is defined in this solution?

Anyway, just thought I’d put these out there, apologies if I’m incorrect!

Can you please provide a link to the specific challenge you are working on?

I assume it is caused by the same bug as this issue. There is a PR with a possible fix.


The first solution to the Use the reduce Method to Analyze Data is failing unless you remove the comments and spaces between the method chains.

Ah, that explains it. I tried removing the comments and was surprised that didn’t fix it.

Oh, yeah, that’s it…thanks for the comment, cleared things up.