What is the output of following code?
const a;
a = 10;
a = 20;
console.log(a);
----o----
Above code throws error in line 1. The error says SyntaxError: Missing initializer in const declaration
.
A const
variable should be initialized at the time of declaration itself like const a = 10
.