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

Elfar Oliver
Elfar Oliver
3,899 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
218,528 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,572 Points

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

Elfar Oliver
Elfar Oliver
3,899 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