Let vs Var

Before the 6th edition of the ecmascript specification in javascript you could only declare function-scoped variables with var. let allows to declare block-scoped variables.

letvar
scopeblockexecution context
visibilityafter declarationhoisted
can add property to global objectnoyes
redeclarationSyntaxErrorworks
use before init (R-Value lookup)Error(Temporal Dead zone)undefined (declaration is hoisted)
typeof before decl (L-Value lookup)Reference Error(Temporal Dead zone)undefined(declaration is hoisted)

Reference