JavaScript & TypeScript / Quiz
var, let, const: Who Leaks?
Hoisting, block scope, the temporal dead zone, and what const really protects. Six short snippets, predict the output.
- Difficulty
- Easy
- Format
- Quiz
- Points
- 100
- Estimate
- 7 min
// MISSION BRIEF
Your Mission
Three keywords declare a variable, and each one follows different rules about where the name is visible and when it can be read.
For each snippet, predict exactly what Node prints. If the code throws, pick the error. Run nothing: read it the way the engine does, top to bottom.
Speed bonus active.
// FIRST CONTACT
Battle teaser
What does this print? If it throws, pick the error. console.log(greeting); var greeting = "Hello"; console.log(greeting);
- Anull, then Hello
- BReferenceError
- CHello, then Hello
- Dundefined, then Hello
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
javascriptfundamentalsvariablesscopehoisting