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

Contenu du cours

Introduction to JavaScript

Introduction to JavaScript

1. Introduction
2. JavaScript syntax
3. Data Types and Variables

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
Tâche

Swipe to start coding

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

Solution

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 desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 11
toggle bottom row

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
Tâche

Swipe to start coding

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

Solution

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 desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 11
Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Nous sommes désolés de vous informer que quelque chose s'est mal passé. Qu'est-il arrivé ?
some-alt