JS-011

Beginner2 min~2 min read#variables#values#memory
Value vs Variable
The box is not the thing.
Goal
Understand the difference between a variable and the value stored inside it.
Explanation
- A variable and a value are not the same thing.
- A variable is a place where data is stored.
- A value is what lives inside the variable.
- The same variable can hold different values during the program's execution.
- Understanding this difference makes code easier to read and write.
Analogy
The box is the variable. The object inside the box is the value. The box is not the object — it only stores it.
Code
let name = "Vitalii";
console.log(name);Result: Vitalii
Common mistake
Beginners often call the value a variable. In reality, the variable only holds the value.
Remember
- ✦ A variable is a container.
- ✦ A value is the data inside the container.
- ✦ Variables and values are different concepts.
Quick Quiz
What is the variable in let name = "Vitalii"?