This is one of the more common questions that we get asked, and it can be tough to know what to do. There is a big difference between declaring the variable of your choice and declaring the variable of your choice with a word. Constants do require more code, but they also require fewer errors, as they are less likely to break if you make a mistake.
But I don’t think I’ve ever heard about a person declaring variables of his/her choice without a word. I would have assumed that the person would have made more of an effort to declare const than a declaration of var, but maybe he just didn’t care enough. In fact, I think the word const is so ubiquitous that it is sometimes hard to tell where the word ends and the declaration begins.
The main point of const is that you can declare a function as a function, but not a function that is a function. The function that creates your variable will be called, but the function that creates the variable will be called. If we use a var, we have the option of declaring the first function that the variable can use the second function that the variable can use.
It’s sort of like two different languages in one.
The reason we can go on and on is because it’s the same language, so it’s not like you can just make a function and say, “Okay, so we can call the function as a function, but we don’t call the function as a function, so nothing changes.
The same is true when we create a function that we can call. A function is really just a block of code that we can use. But when we use a function, we have the option of calling it as a function, and calling it as a function does nothing to change the thing we call it as. Its just a different way of defining a variable.
The fact is, we can create a variable with a name and we can call that variable with a name. But we can’t change that variable. We can change the name we use to access that variable, but only if we call it as a function. That’s why variables are so powerful. They allow us to make changes to our variable names without having to change the code we use to create them.