Interactive Bug-Fix Playground

Debug & Fix 35 Real-World Broken Code Snippets

Hunt down CSS stacking traps, async race conditions, stale closures, React/Angular memory leaks, and Express header bugs with instant browser verification.

0 / 35 Fixed ✓
Track:
Difficulty:
HTML/CSSEasy

Overlapping Sticky Navbar & Z-Index Trap

As you scroll down the feed, elevated product cards slide ON TOP OF the sticky navbar and block clicks.

HTML/CSSEasy

Flexbox Overflow Text-Truncation Bug

Long filename text breaks out of the 320px flex row instead of showing ellipsis (...), pushing the Delete button outside the box.

HTML/CSSMedium

Responsive Grid Card Height Mismatch

Pricing cards have uneven button positions depending on paragraph length, and rigid `repeat(3, 260px)` overflows narrow screens.

HTML/CSSEasy

position: sticky Broken by overflow: hidden Parent

Sticky filter sidebar refuses to stick on scroll because an outer page wrapper uses `overflow-x: hidden`.

HTML/CSSEasy

100vh Mobile Viewport Clipping (100dvh Fix)

Mobile browser bottom toolbar hides the bottom action button because the full-screen drawer only uses legacy `height: 100vh`.

HTML/CSSMedium

CSS Specificity Override Trap (.is-disabled Button)

Adding `.is-disabled` to a primary action button fails to dim its background because a higher-specificity selector `#toolbar .btn-primary` wins.

HTML/CSSEasy

Modal Backdrop Body Scroll-Lock Leak

Opening the modal sets `document.body.style.overflow = "hidden"`, but closing via backdrop click or Escape forgets to restore scrolling.

JavaScriptEasy

Stale Loop Closure in setTimeout

Calling `scheduleLogs()` resolves with `[3, 3, 3]` instead of `[0, 1, 2]` because every callback shares the same function-scoped variable.

JavaScriptHard

Race Condition in Live Search Fetch

Typing `"re"` (slow 60ms server reply) then `"react"` (fast 15ms reply) leaves stale `"re"` results displayed last!

JavaScriptMedium

Mutating Shared State Object Bug

Applying a 20% discount to Alice’s cart also silently changes Bob’s brand-new cart price because both share nested template references.

JavaScriptMedium

Promise.all Unhandled Rejection Crash

If the optional notifications widget API fails, `loadDashboard` throws and wipes out profile and analytics data too.

JavaScriptEasy

this Context Lost When Passing Object Method as Callback

Passing `counter.increment` directly as a button callback sets `this` to the button DOM element (or `undefined`), returning `NaN`.

JavaScriptEasy

Floating-Point Currency Drift (0.1 + 0.2 !== 0.3)

Checkout cart discount calculation returns `0.30000000000000004` and fails exact coupon validation checks.

JavaScriptHard

JSON.stringify Deep Clone Circular Crash & Date Loss

Using `JSON.parse(JSON.stringify(obj))` throws a `TypeError` on circular references and silently turns `Date` instances into strings.

JavaScriptMedium

Debounce Timer Reset Bug Firing Multiple Times

Declaring `let timerId` inside the returned inner function creates a fresh variable per keystroke, causing every single keypress to fire an API call.

JavaScriptEasy

Event Delegation e.target Child Span Click Bug

Clicking the icon `<span>` inside an action `<button>` breaks `e.target.dataset.action` because `e.target` points to the inner `<span>`.

JavaScriptEasy

Array.sort() Mutating Input & String Ordering Trap

Sorting prices `[100, 20, 5]` returns `[100, 20, 5]` lexicographically AND unexpectedly mutates the original source array in place.

TypeScriptMedium

Unsafe any Runtime Crash on API Response

`getDisplayName(payload)` assumes `payload` is `any` and calls `.toUpperCase()` on `payload.user.name`, throwing TypeError when `null` or missing arrives.

TypeScriptMedium

Discriminated Union Exhaustiveness Bug

A new `{ status: "loading" }` union variant was added to `FetchState`, and `renderBadge(state)` silently returns `undefined` instead of handling it cleanly.

TypeScriptEasy

Object.keys() Strict Indexing Type & Undefined Key Trap

Iterating `Object.keys(map)` crashes or produces undefined when keys are assumed strictly typed, and mutates inherited prototype keys.

TypeScriptMedium

Generic Constraint Missing Property Access Bug

A generic sorting/pluck utility accesses `.id` without constraining `T extends { id: string }`, allowing items missing `id` to produce `"undefined"` keys.

TypeScriptMedium

Async Function Missing Await Returning Promise Wrapper Bug

Forgot `await` inside an async transformation pipeline, leaving callers with a wrapped `Promise` instead of the resolved user name.

ReactMedium

Infinite Effect Re-Render Loop

Because `scheduleEffect` omits its dependency array, every state update triggers another render and runs the fetch effect forever (hitting the 20-render guard).

ReactEasy

Stale State in Rapid Counter Clicks

Clicking the "+3 Batch Increment" button calls `increment()` three times in one click, yet the counter only increases by `+1`!

AngularMedium

Unsubscribed Interval / Observable Memory Leak

Destroying `HeartbeatService` calls `ngOnDestroy()`, yet the `setInterval` subscription keeps firing `onTick` callbacks forever and leaks memory!

AngularMedium

Missing Key / trackBy List Input Focus Loss

Clicking "Prepend Urgent Task" wipes and recreates all `<li>` DOM nodes using `innerHTML`, causing the focused input inside Task A to lose focus and cursor!

ReactMedium

Derived State Copying Props Causes Stale UI

Copying `props.price` into local component state once on mount leaves the displayed total stuck on the old product price when parent switches products.

ReactEasy

Missing Cleanup on window.addEventListener("resize")

Every component mount attaches another global `resize` listener without calling `removeEventListener` on unmount, multiplying callback executions.

AngularHard

Angular / RxJS mergeMap vs switchMap Search Race Bug

Using `mergeMap`-style fire-all concurrency in a typeahead causes an older slow HTTP response ("re") to overwrite the newer fast query ("react") results.

ReactMedium

Next.js SSR Hydration Mismatch (window / Date.now on Initial Render)

Reading `typeof window` / dynamic `Date.now()` directly during first SSR+Client render yields different HTML strings on server vs client, triggering a React hydration error.

Node/ExpressMedium

Express Middleware Hanging & Double Header Sent

Invalid tokens return `401` AND still call `next()` (throwing `ERR_HTTP_HEADERS_SENT`), OR valid tokens hang forever because `next()` is never called!

Node/ExpressHard

Missing Input Validation & Async Error Leak

Negative `amount` / blank `email` reaches the DB layer, and when `saveOrder` rejects, the controller hangs or crashes instead of forwarding to `next(err)`.

Node/ExpressEasy

Missing Return After res.status(400).json() Double-Send Crash

Validation block calls `res.status(400).json(...)` without `return`, so execution continues into DB save and throws ERR_HTTP_HEADERS_SENT.

Node/ExpressMedium

N+1 Sequential Await Loop Slowdown (Promise.all Fix)

Enriching 5 order rows with `await fetchCustomer(id)` inside a `for...of` loop takes 5x longer sequentially instead of running concurrently.

Node/ExpressHard

Express Error Middleware Arity & Malformed JSON Trap

Error handler was declared with 3 parameters `(err, req, res)` instead of 4 `(err, req, res, next)`, so Express skips it and leaks raw stack traces on invalid JSON bodies.