โtemporal dead zone
JS โฉ variable โฉ temporal dead zone
the term "temporal" is used because the zone depends on the order of execution (time) rather than the order of place in which the code is written (position).
{
// TDZ (for `a`) starts
const f = () => console.log(a); // - OK: `a` hasn't been actually referenced.
let a = 3; // TDZ (for `a`) ends.
f(); // OK: `a` called outside TDZ.
}
replit๏ผ"temporal" in time
Last updated
Was this helpful?