JS Daily 18 - Variable Declaration Using Const
Published on 8 Dec, 2020
What is the output of following code?
const a; a = 10; a = 20; console.log(a);
Above code throws error in line 1. The error says
SyntaxError: Missing initializer in const declaration.
const variable should be initialized at the time of declaration itself like
const a = 10.