Temporal dead zone (TDZ)
Në shqip: Zona e vdekur kohore
ShpjegimiSQ
Një let ose const ekziston që në fillim të bllokut, por s'mund ta përdorësh para rreshtit ku deklarohet — gabimi „Cannot access 'x' before initialization“. Kjo hapësirë quhet TDZ.
EnglishEN
A let or const exists from the start of its block, but you can't use it before the line where it's declared — the error “Cannot access 'x' before initialization”. That gap is the TDZ.
Si ta mendosh
Si një karrige e rezervuar: është aty, por s'ulesh dot para se të vijë emri yt.
Lexoje në anglisht
Like a reserved seat: it's there, but you can't sit until your name is called.
Shembull kodijavascript
console.log(x); // ReferenceError
let x = 5;