Variables with let

Learn how to store and update values using variables — the building blocks of every program.

Step 1 of 5

A labeled box that holds a value

Programs need to remember things. A game needs to track your score. A shopping site needs to remember what's in your cart. A chat app stores the message you're typing. In JavaScript, you store values using variables.

A variable has two parts: a name (the label) and a value (what's inside). You create one with the `let` keyword, give it a name, use `=` to assign a value, and end the line with a semicolon. The name can be almost anything you choose — but it should describe what's stored inside, so your code is easy to read.

Think of it this way: Imagine a row of labeled boxes on a shelf. Each box has a name tag and holds one thing inside. A box labeled 'age' might hold the number 25. A box labeled 'name' might hold the text 'Alice'. You can look inside any box by reading its label, and you can swap out what's inside whenever you need to.
Learn more on MDN
JAVASCRIPTREAD ONLY
CONSOLE
Click "Run" to execute your code...