60 seconds

JavaScript typing test

Real lines of JavaScript with every bracket, arrow, dot and semicolon left in. The test above is already set to JavaScript; start typing to begin.

What does the JavaScript typing test look like?

Each run strings together real JavaScript one-liners, shuffled, until there are at least 55 pieces to type. These three are straight from the test:

export function debounce(fn, wait = 120) {
  let timer;
  return (...args) => {
    clearTimeout(timer);
    timer = setTimeout(() => fn(...args), wait);
  };
}
const total = items
  .filter((item) => item.inStock)
  .reduce((sum, item) => sum + item.price, 0);
console.log(`Total: ${total.toFixed(2)}`);
async function loadUser(id) {
  const res = await fetch(`/api/users/${id}`);
  if (!res.ok) throw new Error(res.statusText);
  return res.json();
}

Typed as tokens: export function debounce(fn, wait = 120) and so on, one Space between each.

Type a piece, press Space, and move on. A piece only counts when every character is right. The clock starts on your first key and the run ends when the last piece goes in.

Which symbols slow JavaScript programmers down?

Close to a quarter of every character here is a symbol. Round brackets top the list, because every call and every arrow function needs a pair, followed by the dot of method chains, then equals signs, double quotes and semicolons. This is how often each symbol appears in the JavaScript test, and where it lives on a US keyboard:

SymbolNameShare of symbolsKey (US layout)Finger
(Opening bracket16%Shift + 9Right ring
)Closing bracket16%Shift + 0Right little
.Full stop (dot)13%.Right ring
;Semicolon10%;Right little
=Equals9%=Right little
{Opening brace5%Shift + [Right little
>Greater than5%Shift + .Right ring
}Closing brace5%Shift + ]Right little
,Comma4%,Right middle
"Double quote3%Shift + 'Right little

The arrow => deserves its own practice: it is the equals key and then Shift plus the full stop, both on the right hand, so the left little finger has to be on Shift at exactly the right moment. Strict equality, ===, is three taps of the same key; let them run as one quick burst.

How do I type JavaScript faster?

  • Use the opposite Shift. Brackets, braces and quotes are on the right, so hold Shift with the left little finger. Reaching for the right Shift with the same hand is the most common slow habit in code.
  • Type chains in rhythm. .filter(Boolean).map((x) is a pattern: dot, name, bracket. Say it in your head and the hands follow.
  • Practise camelCase. Capitals in the middle of a name, as in querySelectorAll, need a quick Shift with the opposite hand without breaking the word.
  • Template literals. The backtick sits top left, under Escape. ${ is Shift plus 4 and then Shift plus the opening square bracket.
  • Drill the slips. Click any missed key on your result for a drill built on it.

How is the JavaScript test scored?

Like every Presspace test: net words per minute counts correct characters, five to a word, and accuracy counts every key you press. The result also shows raw WPM, consistency, your slowest pieces and a heatmap of the keys you missed, and every run is saved in your browser.

Write TypeScript at work? The TypeScript typing test adds type annotations, generics and angle brackets.

Code typing tests in other languages

All 6 languages
Advertisements

Questions people ask

What JavaScript code will I type?

Real one-line snippets: a reduce with an arrow function, a querySelectorAll chain, a destructured await, a try and catch around JSON.parse, a Fisher-Yates loop and a template literal with a dollar sign and braces. They are shuffled into every run.

Why is my JavaScript typing speed lower than my normal WPM?

Almost a quarter of the characters in these lines are symbols, and most need Shift or a reach to the edge of the keyboard. One wrong bracket also makes a whole piece wrong. A lower number is normal; what closes the gap is typing brackets and arrows without looking.

Does it include indentation and line breaks?

No. Each line is split on spaces into pieces, and you type the pieces with one space between them. That keeps the test on the symbols and camelCase names that slow programmers down.

Does choosing JavaScript here change my settings?

No. This page opens the code test in JavaScript for this visit only. Your saved code language stays as it was until you choose one yourself in the options above the test.

Keep going

Typing tests by length: 15 second typing test · 30 second test · 1 minute typing test · 2 minute test · 5 minute typing test · 10 minute test · custom text

In other languages: Spanish typing test · French typing test · German typing test · Portuguese typing test · Italian typing test · Test de mecanografía en español · Teste de digitação em português