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 trialJoshua Salmon
2,903 PointsConst vs Let in challenge
In this coding challenge, I originally used "let" instead of "const" for declaring the variables for the answers, but when I would run the code, it would not calculate answers correctly. Does anyone know why this is? I thought the only difference between using const, let, and var is the bugs you will run into when trying to redeclare a variable.
p.s. changing the declaration from let to const made the code execute perfectly
1 Answer
Jonathan Grieve
Treehouse Moderator 91,253 PointsAre you referring to the code challenge that is the final stage in this section? :-)
If so, try keeping the variables and constants,
But instead of the OR operator ||
, change the expressions to use the AND operator. &&
.
You'll need to make sure the expressions also cover each eventually for the money
variable.