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

Yemaya Re
PLUS
Yemaya Re
Courses Plus Student 1,922 Points

Error message on challenge. Confused I am.

Challenge: Create one last variable named profitPerUnit. In that variable store the amount of profit you made for each unit. You can calculate this by dividing the profit by the quantity.

Code: var wholesalePrice = 5.45; var retailPrice = 9.99; var quantity = 47;

var salesTotal = retailPrice * quantity; var profit = salesTotal - wholesalePrice * quantity; var profitPerUnit = profit \ quantity;

Error: Oops! It looks like Task 1 is no longer passing.

Why is it saying this?? I went back to task one, re did it and it was still good like before. But when I arrive at this part of the challenge, it says task 1 no longer passes.. Please enlighten me as I am definitely confused!? Thank you for your time.

script.js
var wholesalePrice = 5.45;
var retailPrice = 9.99;
var quantity = 47;

var salesTotal = retailPrice * quantity;
var profit = salesTotal - wholesalePrice * quantity;
var profitPerUnit = profit \ 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>

1 Answer

Jacob Tollette
Jacob Tollette
27,884 Points

You're using the wrong symbol for division. In your script, you're using "\" which is an escape character. You'll want to use "/" for division.