JavaScript const variables must be assigned a value when they are declared:

Meaning: An arrays declared with const must be initialized when it is declared.

Using const without initializing the array is a syntax error:

Example

This will not work:
const cars;
cars = ["Saab", "Volvo", "BMW"];

Arrays declared with var can be initialized at any time.

You can even use the array before it is declared:

Example

This is OK:
cars = ["Saab", "Volvo", "BMW"];
var cars;
 



Practice Excercise Practice now