Question 4 of 10Pro Only

What is hoisting in JavaScript? How does it affect var, let, const, and function declarations?

Sample answer preview

## What is Hoisting? Hoisting is JavaScript's behavior of moving declarations to the top of their scope during the compilation phase, before code execution. ## How Different Declarations Are Hoisted ### var - Hoisted and initialized as undefined ```javascript console.log(x); //…

hoistingtemporal dead zoneTDZvariable declarationscope

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Full-Stack Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime