Contenido del Curso
Introduction to JavaScript (staging)
Introduction to JavaScript (staging)
Constant 3/3
const
Does Not Allow Hoisting
As discussed in the previous chapter, let
does not allow hoisting i.e. we cannot use a variable before the declaration. Just like let
we can not use hoisting with the const
.it is only supported with var
.
MYPLANET = 'earth'; console.log(MYPLANET); const MYPLANET;
Swipe to show code editor
Rearrange the following code to display the value of SALARY
on the console.
Summary:
- We can neither change the values of the
const
variables through reassignment nor we can redeclare them. - Value should be assigned to
const
variables at the time of declaration.
¡Gracias por tus comentarios!
Constant 3/3
const
Does Not Allow Hoisting
As discussed in the previous chapter, let
does not allow hoisting i.e. we cannot use a variable before the declaration. Just like let
we can not use hoisting with the const
.it is only supported with var
.
MYPLANET = 'earth'; console.log(MYPLANET); const MYPLANET;
Swipe to show code editor
Rearrange the following code to display the value of SALARY
on the console.
Summary:
- We can neither change the values of the
const
variables through reassignment nor we can redeclare them. - Value should be assigned to
const
variables at the time of declaration.
¡Gracias por tus comentarios!