why cannot re-declare same variable name as let and var in js?

216 Views Asked by At

why does let a= 10; var a= 10;

throws error that 'a' cannot be re-declared , as much i know , let variable becomes part of script object in js and var becomes part of global object. then why do i get to see this error?

I think it has something to do with block and functional scoping but somehow i'm not able to use that in this context.

0

There are 0 best solutions below