What is Temporal Dead Zone in JavaScript?

I am 17 years old and a young passionate and self-taught frontend web developer and have an intention to become a successful developer. I usually write about JavaScript and Web Development and share some tips in the articles.
Temporal Dead Zone is a term that describes the position where variables are unreachable;
Here,
- Temporal means, temporary
- Dead means, not in a working state
- Zone means, the area where data is stored
The variables let and const exists in Temporal Dead Zone
TL;DR Temporal Dead Zone(TDZ) ends as soon as the respective variable is called.
/*
Temporal Dead Zone for the name variable
*/
const name = "SnowBit" // Haha, TDZ just ended
console.log(name)
Why was Temporal Dead Zone(TDZ) created?
//Temporal Dead Zone for the name variable
//Temporal Dead Zone for the name variable
//Temporal Dead Zone for the name variable
console.log(name) // Huh, I am in Temporal Dead Zone, let's get out of it
//Temporal Dead Zone for the name variable
//Temporal Dead Zone for the name variable
const name = "SnowBit" // Haha, TDZ just ended
As you can see, the name variable is declared in TDZ and will show error

Thank you for reading, have a nice day!

- Follow me on Twitter - @codewithsnowbit
- Subscribe me on YouTube - Code With SnowBit




