A box with a name
A variable is a named box that holds a value. You declare it once, give it a value with =, then use its name anywhere you'd use that value. This lets you write a number in one place and reuse it everywhere.
Use let when the value might change later, and const when it should stay fixed. The name comes first, then =, then the value:
let x = 200;
const size = 80;Naming
Pick clear names like x, size, or speed. Names can't have spaces — use camelCase for multiple words, like circleSize.
Using a variable
Once a variable exists, you can drop its name into a function call. Here y decides where the circle sits — change the 100 and the circle moves: