Exercise
Break one letter, then repair it
A useful bug report describes what you did, what you expected and what happened instead.
Files
Prompt to start
Here is the exact code I ran: [paste file]. When I click Count, I expect [expected result]. Instead [observed result]. The Console says [paste error]. Show me the smallest edit, name the line or quote it, and explain how I can check the repair.
Steps
- Save the working practice page and press Count once. Use the supplied broken copy for the next step, or save a copy of the working file and change updateCount() to pdateCount() on the line inside the click handler.
- Open the broken copy, press Count and note what happens. Open Developer Tools → Console and copy the first error with its filename and line.
- Paste the broken source and evidence into the prompt. Apply the smallest repair to a new file.
- Reload the repaired file, press Count twice and check the Console again.
In Chrome or Edge press Ctrl+Shift+J on Windows or Option+Command+J on Mac. If DevTools are blocked, the prepared example is designed to report ReferenceError: pdateCount is not defined when you click Count. Label that as supplied evidence. A screenshot is optional; the copied error and exact source are enough.
Check your result
- After the repair, Count changes from 0 to 1 and then 2.
- The same error no longer appears after a fresh reload and two clicks.