4 min read

Eye Training — Start Here

Part 2 of Bug Hunt: hundreds of short plain-JavaScript snippets, sorted by the kind of code you're looking at.

Read this first. It takes four minutes.


Why a second part

Part 1 taught the map (the bug catalogue), the method (reading in passes) and the levels. Its drills are realistic files with several bugs each.

Part 2 trains something narrower and more important in a live round: the reflex. When a senior engineer's eye lands on socket.on(, it has already asked "where's the off? what if this runs twice? what happens on reconnect?" before they've finished reading the line. Nobody is born with that. It comes from seeing each kind of mistake a few times, in short snippets, until it jumps out.

So this part is organised by surface: the API or construct your eye is looking at. In a real review you never see a label saying "race condition". You see a setInterval with an await inside it.


How these drills differ from Part 1

Part 1 drillsPart 2 drills
SizeOne or more files, 20–60 linesOne snippet, 5–15 lines
Bug countShown up frontHidden until you check
Clean snippetsNeverSome snippets have no bug
Grouped byLevel (L1–L6)Surface (try/catch, timers, sockets…)
LanguageTypeScriptPlain JavaScript

Why some snippets are clean. If every snippet has a bug, you learn to invent one. In an interview, saying "this is fine, and here's why" with confidence is worth as much as finding a bug. A clean snippet is scored right when you flag nothing.

Grades. Each snippet's title starts with J, M or S, the same marks as the catalogue: a junior should catch it, an engineer with about three years' experience should catch it, or it's expected of a senior. Chapters go J → M → S, so each one runs from basics to advanced. If you're at about three years, every J and M is the bar; S is where you stand out.


What to do with each snippet

  1. Name the surfaces. Before you read the logic, list what's on screen: a try, an await, a timer, a listener, a cache.
  2. Run that surface's checks. Every chapter ends with "What your eye checks": five to eight questions to ask whenever you see that surface. That list is the trained eye, written down.
  3. Imagine three things: the call that fails, the call that runs twice (or at the same time), and the call that's slow.
  4. Flag lines, or flag nothing. Then check.
  5. For every miss, find the tell. Each chapter's Tells table lists the visual cue that should have caught your eye. Learn the cue, not the snippet.

Do the drills before reading a chapter's checklist for an honest test. Redo your misses a week later.


The surfaces

#SurfaceStatus
11try / catch / finallywritten
12Promises and async/awaitwritten
13Timerswritten
14Events, listeners and socketswritten
15Streams and streaming datawritten
16fetch and the networkwritten
17Caching and memoizationwritten
18Shared state and raceswritten
19Values, equality and numberswritten
20Objects and arrayswritten
21Loops and iterationwritten
22Functions, this and closureswritten
23Time and dateswritten
24Resources and cleanupwritten
25Node serversidea
26AI app codeidea
27Mixed rounds (no labels)idea

The order follows interview yield: async, timers, events, streaming, network calls, caches and races come up in almost every full-stack round, so they're first. Any order works.

The last chapter matters most. Once a chapter title tells you the topic, you're half-way to the answer. Mixed rounds shuffle every surface together, with no hint, which is what a real review feels like.


Where the depth lives

These chapters are for reps, not explanations. When a bug surprises you, the full story is elsewhere: