A variable is a labelled box you put a value in, so you can use and change it later.
let makes a box you can change, const makes one you can't — both hold a value with a name.let score = 10; // a box named score, holding 10
score = 15; // fine — let can change
const name = "Aisha"; // a box that must NOT change
// name = "Bruno"; // ERROR — const can't be reassigned
const by default (it prevents accidental changes). Use let only when you know the value needs to change, like a counter. You'll rarely need the old var.| Type | Example | For |
|---|---|---|
| string | "hello" | text — always in quotes |
| number | 42, 3.14 | any number, whole or decimal |
| boolean | true / false | yes/no, on/off decisions |
| array | [1, 2, 3] | an ordered list (next section) |
| object | { id: 1 } | a labelled record (next section) |
Backticks `…` let you drop variables straight into text with ${...} — far nicer than gluing with +. Change the values and run:
typeof x tells you a value's type — handy when something behaves unexpectedly (a common bug is a number that's secretly a string like "3").const locks the value — reassigning it throws an error, which protects you from mistakes."3" (with quotes)?"3" + 1 gives "31", not 4 — a classic beginner trap.`Hi ${name}` when name is "Sam" produces…${ }.