JS Sketchbooksee JavaScript think ✏️
← back to phase 0

0.4 — Memory: the wall of boxes

The machine executes millions of instructions per second — but here’s the catch: by itself, each instruction is instantly forgotten. For a program to do anything useful, it needs somewhere to keep things while it works: the score so far, the name you typed, the page you’re on.

That somewhere is memory — and the picture you’re about to see, a giant wall of tiny boxes, will come back in every phase of this journey. It’s the single most reused drawing in the whole app.

watch it happen

This is memory — RAM. Think of it as the machine’s workbench: a huge wall of tiny boxes, each able to hold one small piece of information. A real machine has billions of them; here are 24.

memory (RAM)…and billions more boxes just like these
under the hood

The deeper story, with the real names for things — this part is what turns “I saw it” into “I can explain it.”

What’s actually inside a box? A tiny number — that’s all memory can physically hold. One box (a byte) stores a number from 0 to 255.

Everything else is built from those numbers by agreement. The letter A is stored as 65. Colors are three numbers (red, green, blue). Sound is thousands of numbers per second. Text, photos, games — all of it is numbers in boxes. That is the entire secret of computers.

The two-tier system has real names. RAM is the workbench: fast, fairly small, wiped when the power stops — a laptop has 8–16 GB, billions of boxes. Storage (the disk) is the cupboard: much bigger, much slower, permanent — where files live.

A program constantly pulls things from the cupboard onto the workbench, works on them there, and must deliberately put results back if it wants to keep them.

Now the good news for you specifically: in JavaScript, you will never juggle box addresses yourself. The engine picks the boxes and tracks them for you.

It even sweeps up the ones you no longer need — a janitor called the garbage collector (properly met in Phase 5). What YOU get to do is attach names to boxes — and exactly that is a variable. Which is the very next phase.

your turn

✏️ Quick check 1

While a program is running, it keeps its working values on the fast, temporary workbench. Type its three-letter name.

✏️ Quick check 2

Why do apps have a Save button at all?

✏️ Quick check 3

A photo of your dog, the text of this page, a song — in memory they are ALL stored as ___. Type the one word.

teach it back

🗣️ Now teach it back

Explain to a friend, using the workbench-and-cupboard picture (or your own): what is RAM, what is disk storage, and why does unsaved work disappear when a program crashes?

Write it as if your friend is sitting next to you. Saved to your journal — future-you will use these notes to teach others.

a few sentences, minimum — you’ve got this
to remember
RAM = the workbench: billions of numbered boxes, instant to reach, wiped when the program ends.
Disk = the cupboard: big, permanent, slower. Save = copy from workbench to cupboard.
Everything in memory is numbers — text, photos, sound — by agreed-upon encodings. And in JS, the engine manages the boxes; you just attach names (next phase!).