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

Mayank Sapra
Mayank Sapra
4,555 Points

I am unable to complete 'Doing Math' Challenge.

For some reason I am unable to move ahead in 'Doing Math' code challenge of Javascript Basics's Number subsection. For task 1, I have added the following statement : var salesTotal = retailPrice * quantity; As directed by the instructions, moving on to complete task 2 requires addition of the following statement : var profit = salesTotal - (wholeSalePrice * quantity); according to instructions specified in the task. On clicking check work I receive a prompt Oops! It looks like Task1 is no longer complete. Please suggest what's the issue as I am done with the amount of thinking I could to resolve this?

script.js
var wholesalePrice = 5.45;
var retailPrice = 9.99;
var quantity = 47;
var salesTotal = retailPrice * quantity;
var profit = salesTotal - (wholeSalePrice * quantity);
index.html
<!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

Per Karlsson
Per Karlsson
12,683 Points

Seems like you have a typo on wholeSalePrice.

There's a lower case "s" in the variable declaration but an upper case "S" in the multiplication.

Jessica DiPonziano
seal-mask
.a{fill-rule:evenodd;}techdegree
Jessica DiPonziano
Full Stack JavaScript Techdegree Student 20,782 Points

JavaScript is case sensitive.

Your variable has a lowercase S in 'wholesalePrice'

Later on in the code you call the variable but with a capital S 'wholeSalePrice'

Maybe this is causing your error.

Hope this helps!