Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
A var binding is initialized to undefined before its declaration runs. let and const bindings exist but cannot be accessed before initialization because of the temporal dead zone.
Inside a function, console.log(x); var x = 2 prints undefined, not 2. In console.log(y); let y = 2, accessing y throws ReferenceError. const behaves like let for this early access. Declarations are handled during scope setup; their initializer expressions are not executed early. Saying let and const are not hoisted misses the distinction between binding creation and initialization.