Learn
Variables
Create a Variable: const
The const
keyword is used to declare variables that have a constant value, meaning their value cannot be reassigned once it is set. This is particularly useful when you have a value that should remain constant throughout your code.
Syntax
To declare a constant variable, it's similar to the var
and let
syntax, just use the const
keyword followed by the variable name and the initial value assigned to it. Here's the syntax:
Instructions
1.
Declare a constant variable called quantity
and assign it the value 5.
2.
Print the value of quantity
to the console.
Sign up to start coding
Already have an account?
Sign In
Course content