DRAFT
ConstDeclarationCanBeLeftUninitialized
Misconception:
Constants declared with the keyword const
can be just declared but only later initialized.
Incorrect
Declarations of constants do not need to be immediately initialized
Correct
Declarations of constants need to be immediately initialized
CorrectionHere is what's right.
Here is what's right.
Using const
to declare a constant also requires to immediately assign a value to that constant. The syntax of JavaScript does not allow to leave the declaration uninitialized.
The syntax only allows to declare and immediately initialize the constant, as demonstrated in the next example.