What is the temporal dead zone in Javascript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the temporal dead zone in Javascript?

I know a thing or two about hoisting in Javascript and the var vs let but dont seem to know what is temporal dead zone is in javascript?

2nd Mar 2018, 4:40 PM
3D CrackerJack
3D CrackerJack - avatar
1 Answer
0
it's all about scope in JavaScript. js have 3 types of variable declaration var , let , const. let and const are block level scope variables it means it can be accessed within the block they have declared. let's come to the question if you access the block level scoped elements before their declaration cause Reference Error. The time span between the creation of variable and it's declaration is called temporal dead zone.
3rd Mar 2018, 5:21 PM
sahir mohamed