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 trialAntonio Nogueras
1,307 PointsCreate 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;
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
3 Answers
Alexander Davison
65,469 PointsYou 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
codebyamir
12,108 PointsLooks like you have a capital S in "wholeSalePrice". Should be "wholesalePrice".
var profit = salesTotal - wholesalePrice * quantity;
Steven Parker
231,268 PointsThe "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").