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 Numbers Working with Numbers Treating Strings As Numbers

Elfar Oliver
Elfar Oliver
3,924 Points

Bold of them to assume I'm gonna use const instead of let as if I'm not gonna earn more badges

So far, no problem with the video. I'm just on a roll and in a good mood

2 Answers

Steven Parker
Steven Parker
230,946 Points

Declaring the variable "const" doesn't prevent you from entering a different value next time the program runs. Being "const" just means it cannot be changed during the same run, and since the program ends right after displaying the result, that will never be an issue.

Obviously, declaring with "let" will work just fine, the video is just illustrating the "best practice" concept of using "const" for anything that won't be changed as the program is running.

Lasse Grosbøl-Rais
Lasse Grosbøl-Rais
10,933 Points

Dude, I'm pretty convinced that Elfar was just joking here

Elfar Oliver
Elfar Oliver
3,924 Points

Lasse, no worries. Check Steven's points and you see all he does is help and he knows practically everything. He has replied to almost every problem I've had regardless of the programming language I'm studying