ConstDeclarationCanBeLeftUninitialized
DRAFT

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

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

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.