Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
210,070 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"