🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)
🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)

🔧 Programmierung 🕛 kürzlich 2 Min Lesezeit
0

Are let and const hoisted?🤔 What is the Temporal Dead Zone?

↗ Quelle (dev.to)
🗣️ Stimme:

Yes, let and const declarations are hoisted, but they are hoisted differently from var declarations.




CODE
console.log(b); // undefined
let a = 12;
var b = 28;






We know that we can access "b" even before it is initialized. It does not give an error but instead returns a special value: undefined.




CODE

console.log(a); // Uncaught ReferenceError: Cannot access 'a' before initialization
let a = 12;
var b = 28;






This code gives an error, indicating that the variable can only be accessed after it is initialized.




CODE
let a = 12;
console.log(a); // 12
var b = 28;






JavaScript allocates memory for "a" and "b" even before a single line of code is executed. In the case of var(b), it is in the global space, while for let(a), it is in the script scope. The memory assigned to "b" is attached to the global object. Although let and const also have allocated memory, they exist in a separate memory space. This memory space for let and const declarations cannot be accessed before they are initialized.




CODE
console.log(a);

let a = 12; //TDZ Ends

var b = 28;






The period from when the let variable is hoisted until it is initialized with a value is called the Temporal Dead Zone. If we try to access a variable inside the Temporal Dead Zone, it results in a ReferenceError. In this code, JavaScript allocates memory for "a" in the script (as undefined) even before execution begins. The variable "a" remains in the Temporal Dead Zone until a value is assigned. Anything before the line (let a = 12) represents the Temporal Dead Zone for "a".



let is stricter than var, and const is even stricter than let.




CODE

let a;
a = 11;
console.log(a); // 11 --> We can declare and assign a on different lines.
-------------------------------------------------------------------------
const b;
b = 28;
console.log(b);//Uncaught SyntaxError: Missing initializer in const declaration.(We have to initialize it on the same line.(Like this-->const b = 28))
-------------------------------------------------------------------------
const b = 30;
b = 28;
console.log(b);//script.js:37 Uncaught TypeError: Assignment to constant variable.






Credits to Akshay Saini.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Hackers Just Poisoned the Rust Supply Chain | Threat Wire
1 Quelle
Hackers Found a Way Into Humanoid Robots | Threat Wire
1 Quelle
Bits und so #1021 (Passwort für Laufwerk)
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Are let and const hoisted?🤔 What is the Temporal Dead Zone?

Thematisch verwandte Begriffe: const, hoisted, What, Temporal · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...