05: Constants

Sometimes you need to create a variable that can never change. In programming this is usually called a "constant". A constant is more like a fact that should be the same value all the time. The concept of a constant is fairly new to JavaScript, so there are not too many guidelines on how to use them. I would say, use them sparingly until you figure out what works best. One place you will see them used is when you create functions in new JavaScript code.

The Code

{{ ork.js() }}

As you can see here the keyword const is used to create a constant. This means a variable cannot change, so if you look at lines 9 and 10, you will see they are commented out (meaning disabled). You should remove the comment in front of line 10 to see thet error message you get. You should watch me do this in the video as it is easier to see it being done than to read about it.

80% Discount for Alpha 1

Register today for the early access release and get an 80% discount on the final release price. You'll get true lessons in true modules right now, and early access to content as it's released.


Still Not Sure? Check out more curriculum!