Welcome to the Treehouse Community
Looking to learn something new?
SeHyun Choi3,441 Points
What is const?
Owen McComas8,472 Points
Great question! a lot of those videos you have been watching so far were recorded before the new syntax came out. 'const' and 'let' are both newer ways used to declare a variable just like var. The details of how they differ and the reasonings for their implementation are explained in this course
Michael Hulet47,869 Points
As others have pointed out, the videos you watched were probably recorded before ES2015 was popular, and you should totally go back and watch those that the others recommended. To answer your question directly, though, it's like a variable, but you can't change its value after you define it. In other words, its value is guaranteed to be constant. For example, running this code:
const something = 1; something = 2;
will result in this error:
TypeError: Attempted to assign to readonly property.