DEV Community

machy44
machy44

Posted on • Edited on

1 2

Temporal Dead Zone

I got a question on the last job interview what is the Temporal Dead Zone. I have not heard about this concept before and as you can guess I did not know the answer. This gave me an idea to write this post about the concept. This post will be short and sweet. Let's get to the point.

What is the Temporal Dead Zone

When you are working with var keyword it will be hoisted and initialized with the undefined value. let and const are also hoisted but they do not get an initial value. Let's see an example:

console.log(varTest); //undefined
var varTest;
console.log(letTest); //ReferenceError: letTest is not defined
let letTest

Maybe this was not the best example but it serves a purpose.

Conclusion

That is the Temporal Dead Zone. Nothing spectacular but now if you hear that term somewhere you will know what is it about.

If you have some thoughts to share or I missed something feel free to comment.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up