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.
123MYPLANET = 'earth'; console.log(MYPLANET); const MYPLANET;
Swipe to start coding
Rearrange the following code to display the value of SALARY on the console.
Solução
Summary:
- We can neither change the values of the
constvariables through reassignment nor we can redeclare them. - Value should be assigned to
constvariables at the time of declaration.
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Can you explain why the code sample results in an error?
What is the difference between `let`, `const`, and `var` regarding hoisting?
Can you give more examples of using `const` correctly?
Incrível!
Completion taxa melhorada para 2
Constant 3/3
Deslize para mostrar o menu
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.
123MYPLANET = 'earth'; console.log(MYPLANET); const MYPLANET;
Swipe to start coding
Rearrange the following code to display the value of SALARY on the console.
Solução
Summary:
- We can neither change the values of the
constvariables through reassignment nor we can redeclare them. - Value should be assigned to
constvariables at the time of declaration.
Obrigado pelo seu feedback!
single