const
scope is defined as ‘block scoped’ (the scope of which, is restricted to the block in which it is declared).
Constants are block-scoped, much like variables defined using the let
statement. The value of a constant cannot change through
re-assignment, and it can’t be redeclared.
Regarding your specific issue:
First as comments said const
is relevant in ES6. I don’t know about you but i get (typing your line 2: var a = 3;
): SyntaxError: Identifier ‘a’ has already been declared
so your example is not quite possible.