4.4.1. Creating Constants With const¶ code example
Example: 4.4.1. Creating Constants With const¶
/*One of the key features of variables that we have discussed so far
is their ability to change value. We can create a variable with one
value, and then reassign it to another value.*/
let programmingLanguage = "JavaScript";
programmingLanguage = "Python";
/*We might store the name of our application in a variable so that it
can be referenced anywhere we want to display the application name.*/
let appName = "Get It Done!";
/*Using const rather than let to create a variable ensures that the
value of the declared variable cannot be changed.*/
const appName = "Get It Done!";
/*Such an unchangeable variable is known as a constant, since its value
is just that.*/