Can the user observe the hoisting of identifiers declared with let
(or const
)?
I ask because referring to the identifier before the lexical declaration will always result in a ReferenceError
as though it had not been hoisted.
Assume strict mode:
{ a; console.log(a); let a; } // ReferenceError: Cannot access 'a' before initialization
{ a; console.log(a); let b; } // ReferenceError: a is not defined
Is the different textual error description the only meaningful way to observe the hoisting in userland?