How to remember what you learn in JavaScript: peg the washing
By Kylo · · 9 min read

How do you remember what you learn in JavaScript? The short answer: you peg it. You build strong associations with what you learn, then make yourself recall it, again and again, over time. In practice that means two habits. For theory, keep tidy notes and turn them into spaced repetition flashcards. For projects, don't stop when the code works: refactor it, reflect on it, and write down what it taught you.
This is step 3 of my See, Build & Peg learning system. Step 1 is seeing the model, step 2 is building sand castles, and this post is about making all of that stick. If you're new here, start with the main guide: How to learn and remember JavaScript.
Why you forget what you learn: the crumpled heap of washing
I have reviewed hundreds of junior developers' pull requests and helped students with countless projects. Do you want to know what 90% of that code looks like?

A crumpled heap of washing, strewn across the floor. Even portfolio projects often look like this. Here's a typical GitHub repo:

And here's what's inside:

The tell-tale signs your code is on the floor
Here are the signs your code, once working, has been unceremoniously dumped on the floor:
- Variables are declared top, bottom, middle and everywhere.
- Functions are so long they could be turned into a novel.
- If/else statements are so nested they could be the setting of the next Maze Runner film.
And here are the signs your project has been dumped there too:
- There is no README.
- There is one single, lonely commit, usually called "first commit".
- There is one single, lonely branch, usually just main.
- Secrets and environment variables are scattered everywhere.
- The code has no comments, or silly ones like "This needs to change…".
The state of these projects is a reflection of your mental model:

Don't worry if I've just described all your code. You're not on the wrong path. This is a necessary stage of building a mental model: the chaotic, get-it-to-work stage.
But don't get stuck there. The danger is that you stay in this stage for months, finishing project after project without really learning from any of them. Here's what you need to do instead: start pegging.
What pegging means (and why it works for programming)
The term comes from a well-known memory technique for remembering lists. You peg each item to a number by creating a silly association with it. Buying carrots? 1 looks like a carrot. Need drain cleaner? 2 looks like the pipes under a sink. And so on.
Remembering lists like this doesn't help much with programming. But the principle underneath it, association, is fundamental to recalling anything, and recall is exactly what we need as programmers.
We need strong associations with everything we code, everything we learn, and even the mistakes we make. Knowledge with nothing to hang on to falls on the floor with the rest of the washing.
The Great Sync is not an analogy
Association is at the core of The Great Sync. It's a representation of JavaScript pegged to a single location: a fictional universe of floating islands.
Location is one of the most powerful mechanisms for recalling knowledge. It's what the famous Memory Palace technique is based on: when you need to remember something, you mentally walk to the place where you stored it. The place doesn't have to be real. It just needs to be one place, whether that's your office, Hogwarts or an imaginary house.
That's why I never call The Great Sync an analogy. An analogy compares a concept to something else, like driving a car or ordering food at a restaurant, and then you leave it behind. The Great Sync is about learning, linking and storing concepts together, in the same world.
In Imagine JavaScript, each concept gets a silly (and therefore memorable) visual, is linked to the concepts around it, and is added to a model you can walk back into whenever you need it.

That's the power of association. But you don't need The Great Sync to use it.
How to remember programming theory: tidy notes, then spaced repetition
For any theory you learn, I suggest 2 key steps.
1. Keep tidy notes
Pegging knowledge to a collection of notes is very effective. I keep all of mine in Notion, and I edit, summarise and improve them often. They're a living thing that needs constant maintenance.

If you revise your notes regularly, something nice happens: when you think of a concept, you can often picture the exact page that explains it, code examples and all. The page becomes the location.
But notes alone are NOT enough.
2. Use spaced repetition flashcards
The problem with note-taking is that there isn't enough cognitive effort in it. Rereading feels productive, but there's no real learning without effort.
Building sand castles is one way to create that effort. Flashcards are another, and they're brilliant for theory. There's a lot of research behind this. If you're curious, I highly recommend the book Make It Stick.
I use Anki, which is free and built on spaced repetition: it shows you each card at longer and longer intervals, just as you're about to forget it. Each review costs you a little effort, and that effort is what moves knowledge into long-term memory.

Good cards for coding are short and specific. Ask "Name 3 problems with .innerHTML", not "Explain the DOM". When you've answered, you rate how hard it was, and Anki schedules the next review.

A quick word on AI. Tools like ChatGPT can happily generate fifty flashcard questions from your notes in seconds. That's fine for spotting gaps, but don't let them do the whole job. Deciding what's worth asking and phrasing the answer in your own words is itself the cognitive effort that makes the cards work.
The 4-step system for any new piece of theory
Put together, here's your learning system for anything new:
- Watch the video or tutorial, and take notes.
- Condense, summarise and improve those notes.
- Come up with questions about them, as described in the main guide.
- Add the questions and answers to Anki, and review them at spaced intervals.
Congratulations: you're now pegging what you learn, instead of leaving it on the floor and hoping you'll remember it one day.
This is also why every chapter of Imagine JavaScript ends with a peg card, a one-page summary that locks the chapter in, followed by a reflection page where you write down what you learned. You can see a peg card in the free Engine chapter.
How to turn messy projects into real learning: 6 steps
Your sand castle projects are THE most important source of learning and progress. The mistake most people make is thinking that once a project works, the job is done and it's time for the next one.
If someone asked you to list the problems you hit in your last project and how you solved them, would you know where to start? Here's how to turn each project into a learning resource you can come back to.
Step 1: Identify Base Camp before you start coding
As described in Build sand castles, aim for the most basic working version of your project first. That's Base Camp. Then sketch an Everest Map: an outline of the features and versions you plan beyond it. You can use this Project Template.
Step 2: Set up git and GitHub
You'll practise a fundamental developer skill, and you'll create a record of your project as it grows. Do these 2 things:
- Paste your Everest Map into the README, so your GitHub page already describes what you're building.
- Create a main branch and a development branch. Work only in development. When a version is finished, open your own pull request into main.

Step 3: Struggle to reach Base Camp
Now the coding begins. It won't be easy, and that's the point: the struggle is the cognitive effort. Remember, the goal is only the most basic version of your project.
Step 4: Refactor like a nasty senior developer
Once you reach Base Camp, open a PR from development to main and call it "Version 1".
Now pretend you're a nasty senior developer who points out every flaw they can find. List them all:
- complicated if/else statements
- very long functions
- messy organisation of your code
- the button doesn't work
- the modal has a weird display issue
Merge the PR and start on "Version 1.1" with your improvements.
Step 5: Reflect and peg
This is the critical step most people skip. Reflection, combined with new perspectives, is what untangles a faulty mental model.
Go through your code again, line by line, and answer these questions:
- Which snippets and patterns here are worth remembering?
- What did I learn along the way?
- What am I still unsure about? Do I need to research anything?
These reflections are gold. Keep them in your notes, write a blog post about them, or (my recommendation) turn them into Anki cards so they come back to you at spaced intervals.
Step 6: Update the README and continue
Your project has only reached Base Camp, and there are more features ahead. Before you start them, update the README: mark the first version as complete, briefly list the improvements from the refactor, and mark the next version as "In progress".
Then start the cycle again.
Why this helps you stand out in the job market
When I was hiring a lead React developer, I was amazed at how quickly candidates listed their skills, and how vague they were about their process. These are the kinds of questions interviewers ask:
- What is your process for building an app or a new feature?
- How do you review pull requests?
- How do you handle versioning?
- When and how do you refactor?
If you've been pegging your projects, you have real answers, with a GitHub history and README to back them up. The See, Build & Peg system forces you to be process-oriented, and that shows.
Pick up the washing and peg it

Pegging, building associations with what you learn and consolidating it, is the step almost every bootcamp and course leaves out. Even the simple act of refactoring your code and combing through it line by line will pay off for years.
There's a lot packed into this step, so don't try to do it all at once. Pick one project, give it a README and a second branch, and write your first five flashcards this week. 💪