Loading Depth Study
Preparing your workspace
Variables and constants are named references used to store or represent values that a program works with.
Programs need to remember information such as names, prices, scores, and user preferences. A variable gives that information a name so the program can use it later. Variables can usually change during execution, while constants are intended to keep the same value. Naming should clearly communicate what the stored value represents.
An online store can store the product price in one variable and the tax rate in a constant.
let price = 500; let quantity = 2; const taxRate = 0.18; price = 450;
The price changes from 500 to 450, while taxRate remains fixed.