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

Create another variable named profit. It should hold the value of the salesTotal variable minus the wholesalePrice multi

Keeps telling me to go back to task 1 because its not passing when I clearly have it correct. this is a flat-out bug.

var wholesalePrice = 5.45;
var retailPrice = 9.99;
var quantity = 47;
var salesTotal = retailPrice * quantity;
var profit = salesTotal - wholeSalePrice * quantity;
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

3 Answers

You have a capital S in wholeSalePrice when the S is supposed to be lowercase.

JavaScript is case-sensitive which means that even if you have a uppercase letter in a variable name and you type it lowercase (or the other way around), it would be considered a different variable.

I hope this helps. ~Alex

Amir Boroumand
Amir Boroumand
12,108 Points

Looks like you have a capital S in "wholeSalePrice". Should be "wholesalePrice".

var profit = salesTotal - wholesalePrice * quantity;
Steven Parker
Steven Parker
215,939 Points

:point_right: The "not passing task 1" could just be a syntax error.

Since the challenge re-tests the older tasks first, if a syntax error has been introduced it may cause it not to pass task 1 even though the error is not in the code that was added for task 1.

But for your task 2 code, you spelled "wholeSalePrice" with a capital "S", when the variable already established by the challenge is "wholesalePrice" (lower-case "s").