Redeclared variable inside the block using let keyword and accessed before it but gives error

135 views Asked by At
var a=10;
{
 console.log(a);
 let a =20 ;
}

ReferenceError: a is not defined

Why it is giving the reference error even a is declared using var which should have its scope inside the block too ?

0

There are 0 answers