DEV Community

advait singh
advait singh

Posted on

can't access let before initialization?

why can we access var before the initialization even tho the value is undefined
but an error pops up if the same is done with let ???
Image description
Image description

Top comments (1)

Collapse
 
ynksdk1654 profile image
ynksdk1654

Hoisting
var
let

For deeper understanding, you need to study Execution Context and Lexical Environment.