let, const, and avoiding var
let and const basics, why to avoid var, block scope, and a gentle intro to the temporal dead zone (TDZ).
Intro
Goal: Use let and const confidently, avoid legacy var, and understand block scope and TDZ.
- let vs const
- Block scope
- TDZ safety

let vs const basics
Rule: Use const unless you plan to reassign; otherwise choose let.
// Prefer const by default; use let when you need to reassign
const appName = "CoddyKit";
// cannot reassign
let score = 0;
// can reassign
score = score + 1;
console.log("App:", appName);
console.log("Score:", score);

All lessons in this course
- let, const, and avoiding var
- Block/Function/Module Scope and the TDZ
- Naming, Readability, and Common Pitfalls