Constants – Programming Simplified
Constants
Constants are values that can’t be changed once they are set. Think of this like your birthday. You are born on a specific month, day and year and once that happens you can’t get a new one.
Syntax – ECMAScript6
const birthday = "07/24/1992";
- const
- This is a special word that means, I can only be given a value once. Think giving getting a birthday
- birthday
- The word that comes after const is special name for so your computer to know what to do when it sees this name again
- =
- This symbol is give your name a value
- “07/24/1992”
- This is the value you assign to the special word you chose
If you want to display what value birthday has you would do the following:
console.log(birthday);
Output: “07/24/1992”
If you like this article or would like a specific topic explained drop a comment below. I would love to hear your feedback!