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 trialSezare Miguel
9,229 PointsHow can I calculate the last variable profitPerUnit ?
const wholesalePrice = 5.45;
const retailPrice = 9.99;
const quantity = 47;
salesTotal = retailPrice * quantity;
profit = salesTotal - wholesalePrice * quantity;
profitPerUnit = prift / quantity ;
3 Answers
Steven Parker
231,275 PointsYou're really close, you just have a spelling error. You wrote "prift" instead of "profit".
And while not necessary just to pass, it would be "best practice" to declare the new variables.
Julia Lam (Daly)
5,230 Points<p>You're really close (as Steven said). the new variable needs a declaration.
It could be "const", "let", or "var"
>salesTotal = retailPrice * quantity;
>profit = salesTotal - wholesalePrice * quantity;
>profitPerUnit = prift / quantity ;
Added declaration as shown below:
let salesTotal = retailPrice * quantity;
let profit = salesTotal - wholesalePrice * quantity;
let profitPerUnit = profit / quantity ;</p>
Sezare Miguel
9,229 PointsThank you guys very much i really appreciate it! I cant believe it that i am that a bad speller.
Steven Parker
231,275 PointsSezare Freta Miguel — Spelling errors are the bane of gurus and chelas alike.
Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!