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 Numbers Working with Numbers Doing Math

How can I calculate the last variable profitPerUnit ?

script.js
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
Steven Parker
229,644 Points

You'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.

<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>

Thank you guys very much i really appreciate it! I cant believe it that i am that a bad speller.

Steven Parker
Steven Parker
229,644 Points

Sezare Freta Miguel — Spelling errors are the bane of gurus and chelas alike. :wink:

Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!