Course Content
Introduction to JavaScript (staging)
Introduction to JavaScript (staging)
Constant 1/3
What are Constants?
Constants are created just like the var
and let
. We use the const
keyword for initializing constants, for example.
const NUMBER = 58; console.log(NUMBER);
Variables declared with const
are very much similar to the variables declared with the let
keyword, but the only difference is that we cannot reassign values to the variables declared with the const
keyword.
const PI = 3.141592653589793; PI = 3.14; // error console.log(PI);
Swipe to show code editor
Declare a variable by using the const
keyword with the identifier FIXED
and assign the value 10 to it also display the value on the console.
Thanks for your feedback!
Constant 1/3
What are Constants?
Constants are created just like the var
and let
. We use the const
keyword for initializing constants, for example.
const NUMBER = 58; console.log(NUMBER);
Variables declared with const
are very much similar to the variables declared with the let
keyword, but the only difference is that we cannot reassign values to the variables declared with the const
keyword.
const PI = 3.141592653589793; PI = 3.14; // error console.log(PI);
Swipe to show code editor
Declare a variable by using the const
keyword with the identifier FIXED
and assign the value 10 to it also display the value on the console.
Thanks for your feedback!