Week 7: Variables and naming
JavaScript code typing course. 16 wpm, 92% accuracy.
A variable stores a value under a name, so you type a name, an equals sign and a value. Names in JavaScript cannot contain spaces, so you join words either with an underscore, as in best_score, or by capitalizing each new word, as in bestScore. This week you learn to type both symbols that appear in most names and assignments, and you practice keeping your naming style consistent.
What you will learn
This week introduces two symbols on the US English layout:
_is Shift plus the hyphen key. Press Shift with the opposite pinky and the hyphen key with your right pinky.=is the equals key, pressed with your right pinky.
Practice with lines such as score = 0, which sets a variable named score to 0, and best_score = 10. Both symbols are typed with your right pinky, so keep that hand steady.
Technique tips
- Hold Shift with the opposite pinky before you press the hyphen key, so the underscore appears instead of a dash.
- Put a space on each side of
=, as inscore = 0, which makes the line easier to read. - Think of the whole name before you type it, so you do not stop halfway to decide.
- Keep your right pinky steady for both symbols, and move only the finger.
- Pick one naming style, underscores or capital letters, and keep it in each program.
Lessons
- Learn (10–15 minutes): Watch the keyboard demo for
_and=, then type each one a few times. - Practice (10–15 minutes): Type
score = 0andbest_score = 10again and again, keeping the spacing even. - Review (10–15 minutes): Take the two-minute test and focus on the underscore, which is the symbol people miss most.
This week’s goal
Your targets are 16 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 wrong underscore creates a different name, so get each name right 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.
This week’s lessons
Do the lessons in order. Each one ends with a test, and your best result is saved.