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

Josh Rubner
PLUS
Josh Rubner
Courses Plus Student 6,766 Points

const to hold changing value?

Why use a const when the value is expected to change? I thought that was the purpose of let?

It's works fine in the example, which is confusing...

2 Answers

David Sims
David Sims
857 Points

const in JavaScript isn't really a "true" constant. If you have an object that's declared as a constant, you can just mutate the key-value pairs. But yes you should be using let if you expect the value to change.