SyntaxError: missing = in const declaration
declaration was not given a value in the same statement (like
const RED_FLAG;). You need to provide one
const RED_FLAG = '#ff0').
SyntaxError: Missing initializer in const declaration (V8-based) SyntaxError: missing = in const declaration (Firefox) SyntaxError: Unexpected token ';'. const declared variable 'x' must have an initializer. (Safari)
A constant is a value that cannot be altered by the program during normal execution. It
constants are declared using the
keyword. An initializer for a constant is required; that is, you must specify its value
in the same statement in which it's declared (which makes sense, given that it can't be
let, you must specify a value for a
const declaration. This throws:
const COLUMNS; // SyntaxError: missing = in const declaration
There are multiple options to fix this error. Check what was intended to be achieved with the constant in question.
Adding a constant value
Specify the constant value in the same statement in which it's declared:
const COLUMNS = 80;