Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics Making Decisions in Your Code with Conditional Statements The Conditional Challenge Solution

Const 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
Jonathan Grieve
Treehouse Moderator 90,689 Points

Are 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.