How to practise JavaScript without copying the answer

Reading a solution creates recognition. Rebuilding it from a blank file creates recall. Here is a practice loop that makes the second one happen.

How to practise JavaScript without copying the answer cover illustration

The dangerous moment in a tutorial is when the example makes sense. It feels like understanding, but recognition is not the same as being able to produce the code. The gap only closes when you write something without the answer in front of you.

The three-pass loop

  1. 01
    Read and predict

    Read a section, then cover the code and say what it will do before you run it.

  2. 02
    Rebuild from memory

    Close the lesson and recreate the smallest useful version in a blank file. Let yourself get stuck for two minutes before looking.

  3. 03
    Change one variable

    Add a different input, a failure state or a new constraint. If the rebuild breaks, you found the boundary of your understanding.

practice.jsJavaScript
const lessons = [
  { title: 'HTML', minutes: 8, done: true },
  { title: 'CSS', minutes: 12, done: false },
  { title: 'JS', minutes: 15, done: false },
]

const remaining = lessons
  .filter((lesson) => !lesson.done)
  .map((lesson) => lesson.title)

console.log(remaining.join(', '))

Do not start with a new project every day. A ten-line exercise repeated from memory is more useful than a copied forty-line app. The repetition should be slightly boring; that is a sign you are building fluency rather than collecting tabs.

Something to add?

Corrections and technical review are welcome. Tell us what we missed.

Send a correction