Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Constant 3/3 | Data Types and Variables
Introduction to JavaScript

Swipe um das Menü anzuzeigen

book
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.

123
MYPLANET = 'earth'; console.log(MYPLANET); const MYPLANET;
copy
Aufgabe

Swipe to start coding

Rearrange the following code to display the value of SALARY on the console.

Lösung

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.

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 11
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

close

Awesome!

Completion rate improved to 2

book
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.

123
MYPLANET = 'earth'; console.log(MYPLANET); const MYPLANET;
copy
Aufgabe

Swipe to start coding

Rearrange the following code to display the value of SALARY on the console.

Lösung

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.

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

close

Awesome!

Completion rate improved to 2

Swipe um das Menü anzuzeigen

some-alt