---
title: "Bug Hunt: Find the Bug in the Code Game | Aback Games"
description: "A debugging game for programmers: find the one buggy line in short JavaScript, Python and SQL snippets, then see why it breaks and how to fix it. Free."
url: https://abackgames.com/games/bug-hunt
---

# Bug Hunt

Spot the buggy line in short JavaScript, Python and SQL snippets. 8 a round, with the cause and the fix after each.

- Developer game
- Free
- No sign-up
- Keyboard
- Touch

## About Bug Hunt

Most bugs are not exotic. They are the same small mistakes, made again and again: a loop that runs once too often, a comparison with NULL, a default value that is shared between calls. Bug Hunt is practice at spotting them quickly, the way you would in a code review.

Each round has 8 short snippets. Every snippet says what it is meant to do and has exactly one line that stops it doing that. Pick the line. Then you see the bug, why it happens and the fixed line, so every snippet teaches you something even when you miss it.

## How to play Bug Hunt

1. Choose JavaScript, Python, SQL or All. There are 12 JavaScript, 12 Python and 12 SQL snippets.
2. Press Start. Read what the code is meant to do, then read the code.
3. Click or tap the line that causes the bug. The bug line is then marked, with the reason and the fix.
4. Press Next snippet to go on. After 8 snippets you see your score.

## Bug Hunt controls

**Keyboard**

- **Move between lines**: Up and Down arrows (Tab reaches the code)
- **Pick a line**: Enter or Space, or click it
- **Next snippet**: Enter (the Next button has focus)
- **New round**: N
- **Sound on or off**: M

**Touch screens**

- **Pick a line**: Tap it
- **Next snippet**: Tap Next snippet

## Bug Hunt rules

### One bug per snippet

Every snippet has exactly one line that causes the problem its description names. The other lines are correct as written. Where a bug shows up on a later line than the one that causes it, the line that counts is the cause: the one you would change to fix it.

Some bugs crash, like a KeyError in Python. Most do not: they quietly give the wrong answer, which is what makes them worth learning to spot.

### Languages

JavaScript snippets run in a browser or Node.js. Python snippets are Python 3. SQL snippets use standard SQL; where a database behaves differently, the snippet says which one it means.

### Scoring and records

Each bug you find scores one point, out of 8. There is no clock. A round never repeats a snippet. Your best score and the number of rounds played for each language choice are saved in this browser on this device.

## Tips and strategy

- Read the goal first, then ask what input would break the code. Empty lists, zero, NULL and the last item of a loop are where most bugs live.
- Check every comparison: < or <=, == or ===, = NULL or IS NULL.
- Watch for values that are shared when they look copied: default arguments in Python, nested arrays in a JavaScript spread, a list multiplied in Python.
- Remember what returns what. Python’s list.sort() returns None; JavaScript’s sort() sorts as text unless you pass a compare function.
- In SQL, think about rows that have NULLs. They are where WHERE, NOT IN and COUNT surprise people.

## Frequently asked questions

Is Bug Hunt good practice for coding interviews?

It helps with the reading side of them. Interviewers often ask you to review or debug code, and spotting common mistakes quickly is the same skill. It is not a substitute for writing code yourself.

Why is the bug on that line and not where the error appears?

A bug is counted on the line you would change to fix it. That is often earlier than the line where things visibly go wrong, and learning to trace back to it is the point of debugging.

Do I need to know all three languages?

No. Choose just the language you use. The bugs in each are ones that people working in that language really make.

## Guides and tips

Developer skills

### [Common coding bugs and how to spot them](https://abackgames.com/guides/common-coding-bugs)

Off-by-one loops, NaN and NULL, falsy zero, shared defaults, sorting surprises and forgotten awaits: what goes wrong and the habit that catches each one.

 4 min read

Developer skills

### [Regular expressions for beginners: a practical guide](https://abackgames.com/guides/regex-for-beginners)

The parts of a regular expression you will use every week, each with a small example, plus the mistakes that catch everyone out.

 4 min read

Developer skills

### [Git branching explained: commit, merge, rebase and reset](https://abackgames.com/guides/git-branching-explained)

What a branch actually is, what HEAD points to, and what merge, rebase, cherry-pick and reset do to the commit graph.

 4 min read

## More games like this

Developer

### [Regex Runner](https://abackgames.com/games/regex-runner)

Write a regular expression that matches every string on one list and none on the other. 24 puzzles, from anchors to lookarounds.

- Keyboard
- Touch

Developer

### [Code Typer](https://abackgames.com/games/code-typer)

A typing test for programmers: type real JavaScript, Python, Rust and SQL code against the clock.

- Keyboard
- Touch

Developer

### [Git Tangle](https://abackgames.com/games/git-tangle)

Learn git branching by doing it: type real git commands until your commit graph matches the goal. 12 levels, from commit to rebase.

- Keyboard
- Touch

[ All games](https://abackgames.com/games)
