JavaScript JavaScript Array Iteration Methods Combining Array Methods Combining filter() and reduce()

Zachary Danz
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Zachary Danz
Front End Web Development Techdegree Graduate 15,023 Points

Adding the .toFixed(2) Method results in this quiz failing

I figure since we're taught the .toFixed method at the end of the last video, and it seems like a best practice, it might be a good idea to either include it as a second step of the challenge or to receive a PASS when used.

As it is now, I got a notification stating that "both the filter() and reduce() methods have not yet been called" or something along those, lines, which was false, and the quiz passed with the same code after I deleted .toFixed(2)

Thank you!

2 Answers

Steven Parker
Steven Parker
207,988 Points

The challenge was expecting a numeric result, but "toFixed" creates a string.

Zachary Danz
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Zachary Danz
Front End Web Development Techdegree Graduate 15,023 Points

Thank you for the explanation, then in fact, .toFixed is wrong after all.

However, I still think the error message could be changed to something like "Result is a string, expected number"