1.1 — What is a value?
Before variables can make sense, meet the thing they hold: values. A value is one piece of data — the number 25, the text "hello", the answer true. Every program you’ll ever write is, at heart, values being remembered, changed and compared.
And every value comes with a type — what kind of thing it is — which decides what you’re allowed to do with it. You can multiply two numbers; you can’t sensibly multiply two sentences.
Here are six values a program might work with. Right now they look like a jumble — but the machine never sees them that way. To the machine, every value belongs to exactly one category.
The deeper story, with the real names for things — this part is what turns “I saw it” into “I can explain it.”
JavaScript has seven primitive types in total. You now know the big three: number, string, boolean.
Coming soon: undefined and null — two flavors of “nothing” (lesson 1.7). Two more are rare: bigint for astronomically large numbers, and symbol for special labels. You can safely ignore those two for months.
“Primitive” means a single, simple value — as opposed to collections like arrays and objects, which arrive in Phase 4.
Why do types exist at all? The machine stores everything as numbers-in-boxes (lesson 0.4). So it needs to know how to interpret a box. The same stored bits mean one thing read as a number, and something else read as text. The type is that reading-instruction. And it decides behavior: 25 + 25 is 50, but "25" + "25" glues text into "2525". Same characters, different type, different result — remember it; a famous interview moment.
✏️ Quick check 1
true (no quotes) is a boolean. So what type is "true" — WITH the quotes? Type the type name.
✏️ Quick check 2
What type is 3.5? Type the exact word.
✏️ Quick check 3
A user types 100 into a form on a web page. Type the exact value the program receives — include quotes if they belong there.
🗣️ Now teach it back
Explain to a friend: what is a value, what is a type, and why are 42 and "42" two completely different things to a computer?
Write it as if your friend is sitting next to you. Saved to your journal — future-you will use these notes to teach others.