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 Basics (Retired) Working With Numbers Doing Math

Andrew Federico
Andrew Federico
7,498 Points

Question 2 out of 3 is incorrect in its requirements.

It states to use salesTotal when it should say retailPrice

2 Answers

Steven Parker
Steven Parker
231,275 Points

:point_right: The challenge requirements are correct.

In task 1, salesTotal was created to hold the retail price multiplied by the quantity.

In task 2, you are starting with that value, and then subtracting the wholesalePrice multiplied by the quantity. This gives the total profit for all items sold.

If you were to start with retailPrice instead, you would be subtracting the wholesale price of all items sold from the retail price of just one item. That would give you a negative number!