Constants with const
Learn how to declare values that never change using the const keyword.
Step 1 of 5
What is const?
Sometimes you have a value that should never change after you set it — the speed of light, the name of your app, or the number of sides on a hexagon. JavaScript gives you the `const` keyword for exactly this purpose. When you declare a variable with `const`, you are telling JavaScript (and anyone reading your code): 'This value is fixed. Do not touch it.'
If any code later tries to reassign a `const` variable, JavaScript will throw an error and stop execution. This is a safety net — it protects important values from being accidentally overwritten.
Think of it this way: const is like a box with a padlock — once you put something in, it stays.
Learn more on MDN
JAVASCRIPTREAD ONLY
CONSOLE
Click "Run" to execute your code...