+ 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?
1 Resposta
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.