thecodezone.
The Code Zone
← Back to the Developer Playbook

Code Zone Bug Lab / Episode 05

The Last Task Goes Missing

Rob has three tasks. The page only shows two. Find where the last one went.

DEV-148 · Arrays · loop boundaries15–20 minutesNo setup or account required
Rob compares three task cards with a preview missing Test.
Rob compares three task cards with a preview missing Test.

Your sprint ticket · In progress · DEV-148

The Last Task Goes Missing.

Customer report: My list has Plan, Build, and Test. The page only displays Plan and Build.

Steps to reproduce

  1. Load the three starter tasks.
  2. Compare the source array with the rendered list.
  3. Use Show one task and Show no tasks to investigate smaller lists.

Fix the rendering boundary. Adding, editing, or storing tasks is outside this ticket.

Acceptance criteria

  • All three starter tasks appear in the original order.
  • A single-item list shows that item.
  • An empty list shows no task rows.
  • Rendering a different list replaces the previous rows without duplicates.

Learning demo only. No real accounts, purchases, or external requests.

Reproduce → inspect → hypothesize → verify

Take the ticket.

Reproduce the reported behavior before editing. Read the Console and inspect the JS tab. Explain one hypothesis, make a focused change, then use Check challenge below the code screen. Edits update the preview. Reveal hints one at a time if needed.

Checking account and saved lab work…

Sign in to sync across devices

Loading the JavaScript and HTML editor…

Pass the checks or make three attempts to unlock an explained example.

Ready to test? Choose “Check challenge” after investigating.

    Open starter in a separate tab

    Code and prediction notes recover in this browser and sync when signed in. Instructor examples stay separate. Reset replaces code, not prediction notes.

    One possible solution

    Compare this approach with your own. Opening it does not change your code or mark the exercise complete.

    The condition i < tasks.length - 1 stops one element too soon. Use i < tasks.length. With an empty array the loop runs zero times; with one item it runs once. Keep the list-clearing step so rerendering does not append duplicates.

    Try first. Reveal one clue at a time.

    Need a lead?

    1. Count the iterations.

    Which indices does the loop visit? Compare the last visited index with the array length.

    2. Check the stopping condition.

    The last valid index is length - 1. A strict less-than comparison stops before its right-hand boundary.

    3. Test smaller lists.

    Use i < tasks.length. Verify both a one-item array and an empty array.

    Your lab report

    Show your reasoning.

    “I expected… I observed… The console showed… My hypothesis was… I changed… I verified…”

    Use Check challenge for automated behavior checks. Passing checks are useful evidence, not a complete code review.

    Give others room to investigate: label solutions as spoilers.

    Share your lab report on SKOOL (new tab) ↗