Variables and expressions
A variable is a name for a value. const declares one that can't be
reassigned - the right default for almost everything, since most values in a
program never actually need to change after they're set. let exists for the
rest.
An expression combines values into a new one: width * height, price + tax,
a > b. You've been doing this in every calculator since childhood; JavaScript
just wants the operators written out (* for multiply, not x) and a const
or let in front the first time a name appears.
Your task: declare width as 8, height as 5, and area as their
product.
You'll practice:
- Declaring a variable with
const
- Writing an arithmetic expression
- Building one variable's value out of two others