Variables
Variables
Section titled “Variables”Variables are the foundation of any program — they let you store, label, and manipulate data.
🎯 Learning Objectives
Section titled “🎯 Learning Objectives”- Declare variables using
var,let, andconst - Understand the difference between function-scoped and block-scoped variables
- Explain hoisting and the Temporal Dead Zone (TDZ)
- Choose the right declaration for every scenario
📖 Topics Covered
Section titled “📖 Topics Covered”| Topic | Description | Est. Time |
|---|---|---|
| var | Function-scoped, hoisting, redeclaration | 15 min |
| let | Block-scoped, no redeclaration, TDZ | 15 min |
| const | Immutable binding, objects & arrays | 15 min |
| Temporal Dead Zone | What is TDZ and why it exists | 10 min |
| Variable Hoisting | How hoisting works for each declaration | 10 min |
🔗 Prerequisites
Section titled “🔗 Prerequisites”- Introduction — what JavaScript is
- Environment — how to run JS
🧭 Learning Path
Section titled “🧭 Learning Path”var → let → const → temporal-dead-zone → variable-hoisting⏱ Total Time: ~1.5 hours Previous: Environment Next: Data Types