Week 9: Loops

JavaScript code typing course. 18 wpm, 92% accuracy.

Loops repeat a piece of code several times without copying it. The most common loop in JavaScript is for, and a line such as for (let i = 0; i < 3; i++) runs the block below it three times. The parentheses hold three parts separated by semicolons, and each part uses symbols you have typed before, plus the semicolon you meet this week. You also meet while, which repeats as long as its condition stays true. Accuracy matters here, because one wrong character can change how many times a loop runs.

What you will learn

This week introduces the semicolon and reviews three symbols. On the US English layout:

  • ; is the semicolon key, pressed with your right pinky.
  • + is Shift plus the = key. Press Shift with the opposite pinky and the = key with your right pinky.
  • = is the equals key, pressed with your right pinky.
  • < is Shift plus the comma key. Press Shift with the opposite pinky and the comma key with your right middle finger.

The new keyword this week is while. In i++, the two plus signs add one to the value of i.

Technique tips

  • In a for line, count the two semicolons before you move on. They separate the three parts.
  • Type i++ as two plus signs in a row, keeping the rhythm even.
  • Keep your right pinky ready for the semicolon key, and move only that finger.
  • Keep your wrist steady when you type < in a condition.
  • Read the loop line once before typing, so you know where it stops.

Lessons

  1. Learn (10–15 minutes): Watch the keyboard demo for ;, +, = and <, then type each one a few times.
  2. Practice (10–15 minutes): Type for (let i = 0; i < 3; i++) and short while lines again and again.
  3. Review (10–15 minutes): Take the two-minute test and focus on writing every loop line completely.

This week’s goal

Your targets are 18 WPM and 92% accuracy. Finishing the week earns one star. Reaching 92% accuracy earns two stars, and reaching the speed target as well earns three. A missing semicolon stops a loop line from working, so write each line correctly before you speed up.

Symbols this week

The colored keys are the ones you learn this week. The color shows which finger presses the key.

` ~ 1 ! 2 @ 3 # 4 $ 5 % 6 ^ 7 & 8 * 9 ( 0 ) - _ = + Backspace Tab Q W E R T Y U I O P [ { ] } \ | Caps A S D F G H J K L ; : ' " Enter Shift Z X C V B N M , < . > / ? Shift Ctrl Win Alt Alt Gr Win Menu Ctrl

This week’s lessons

Do the lessons in order. Each one ends with a test, and your best result is saved.

  1. Lesson 1: Learn

    New symbols: + = < ;

    12 minutes

    Start
  2. Lesson 2: Practice

    Practice

    12 minutes

    Start
  3. Lesson 3: Review and test

    Review and test

    14 minutes

    Start

All weeks