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

task 2 challenge profit not working. Please can anyone help me? I'm stumped.

I've racked my brains over this and looked at other suggestions but doesn't work. Think it may be a bug. I've tried all three methods below and none are working.

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

task 1 var salesTotal = retailPrice * quantity; task 2 var profit = salesTotal - (wholesalePrice * quanity);) var profit = (salesTotal - wholesalePrice) * quanity; var profit = salesTotal - wholesalePrice * quantity;

1 Answer

You are pretty close. There are a few syntax errors with the spelling of quantity and you have an extra ")". I have put them in bold for you.

task 2 var profit = salesTotal - (wholesalePrice * quanity); ) var profit = (salesTotal - wholesalePrice) * quanity; var profit = salesTotal - wholesalePrice * quantity;

Hi, I didn't have any syntax errors in my actual code, but you helped tremendously by confirming that I was on the right track. I tried for I don't know how many times var profit = salesTotal - wholesalePrice * quanity; and it said error. Thx so much!