Variables, Types & Scope
JavaScript has three ways to declare variables: let (reassignable, block-scoped), const (not reassignable, block-scoped), and the legacy var (function-scoped — generally avoid it). Modern code prefers const by default, switching to let only when a value needs to change.
const name = "Ada"; // string, never reassigned
let age = 29; // number, can change
age += 1;
const isActive = true; // boolean
const scores = [90, 85]; // array
const user = { name, age }; // object (shorthand)