TryBugHunt

#30DaysOfDebugging

30 Days of Debugging: JavaScript

One bug a day, for 30 days. Each day is a short piece of JavaScript that almost works, the symptom it causes, and tests that pass once you have fixed it. It takes most people five to ten minutes.

The first three weeks are the bugs every beginner meets. The last stretch is medium level: boundaries, rounding, shared state and an interview problem. Go faster if you like; the days are a pace, not a lock.

Your progress

0 of 30 days

Start Day 1 →
  1. 1Day 1 · Capitalize turns "debug" into "Ddebug"
  2. 2Day 2 · isEven says 4 is not even
  3. 3Day 3 · Free shipping not given at exactly 50
  4. 4Day 4 · First 3 items comes back with only 2
  5. 5Day 5 · Adding up [1, 2, 3] gives NaN
  6. 6Day 6 · Playlist shows undefined as the last song
  7. 7Day 7 · Number sort puts 10 before 2
  8. 8Day 8 · Adding shipping gives a list of undefined
  9. 9Day 9 · Validator never finds the negative number
  10. 10Day 10 · First item name crashes on an empty list
  11. 11Day 11 · Doubling until past a limit never stops
  12. 12Day 12 · Dashboard crashes for a user with no address
  13. 13Day 13 · getName gives back undefined
  14. 14Day 14 · Cart total shows "01020" instead of 30
  15. 15Day 15 · Going from 100 to 150 shows -50%Medium
  16. 16Day 16 · Last 2 items comes back with 3Medium
  17. 17Day 17 · Joining words leaves a dash at the endMedium
  18. 18Day 18 · Removing dashes removes only the first oneMedium
  19. 19Day 19 · Zero counter also counts "" and falseMedium
  20. 20Day 20 · Setting retries to 0 turns them back onMedium
  21. 21Day 21 · Price lookup crashes for an unknown itemMedium
  22. 22Day 22 · Every date shows last monthMedium
  23. 23Day 23 · 1.5 + 2.5 comes out as 3Medium
  24. 24Day 24 · map(parseInt) turns "10" into NaN and 2Medium
  25. 25Day 25 · 0.1 + 0.2 gives 0.30000000000000004Medium
  26. 26Day 26 · Grouping words keeps only one per groupMedium
  27. 27Day 27 · Adding a fee crashes before the fee existsMedium
  28. 28Day 28 · Doubling after a delay returns undefinedMedium
  29. 29Day 29 · AI Attempt: Remove all occurrencesMedium
  30. 30Day 30 · Names list is full of promises, not textMedium

How it works

Prefer Python? 30 Days of Debugging: Python