Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,024 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
231,268 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,024 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"