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 trialChris Fulton
544 PointsWhere is my error? I can't figure out what I am doing wrong.
var wholesalePrice = 5.45; var retailPrice = 9.99; var quantity = 47; var salesTotal= retailPrice* 47; var profit = salesTotal-wholesalePrice * quanity;
var wholesalePrice = 5.45;
var retailPrice = 9.99;
var quantity = 47;
var salesTotal= retailPrice* 47;
var profit = salesTotal-wholesalePrice * quanity;
<!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>
2 Answers
Darren Joy
19,573 PointsWhile
var quantity = 47; is good
var salesTotal = retailPrice * 47; is not
it's asking you to multiply retailPrice times quantity. While this is indeed retailPrice * 47, it's attempting to get you to multiply the two variables together to practice that idea of multiplying quantities but through variables..
so
var salesTotal = retailPrice * quantity;
is the correct line
Marcus Parsons
15,719 PointsThere is also a spelling error on the quantity
variable in the last line. It says quanity
instead of quantity
.
Ted Sumner
Courses Plus Student 17,967 PointsI am guessing it should be salesTotal = retailPrice * quantity.
Mark Casavantes
Courses Plus Student 13,401 PointsMark Casavantes
Courses Plus Student 13,401 PointsChris
Are you getting a math error? I am not sure what kind of error you are getting. I think the last line in your script.js file should be:
var profit = (salesTotal-wholesalePrice) * quantity;
I hope this is helpful.