JavaScript
Cap nhat 15 thg 1, 2026Debugging JavaScript Like a Pro
Advanced debugging techniques using browser DevTools, console methods, and systematic approaches.
javascript
debugging
devtools
Console Methods Beyond log()
- `console.table()` for arrays/objects
- `console.group()` / `console.groupEnd()` for organized logs
- `console.time()` / `console.timeEnd()` for performance
- `console.trace()` for call stack
Breakpoint Types
- Line breakpoints: click the gutter
- Conditional breakpoints: right-click > add condition
- DOM breakpoints: break on subtree modifications
- XHR breakpoints: break on specific URL patterns
Systematic Debugging
1. Reproduce the bug consistently
2. Isolate the smallest failing case
3. Form a hypothesis
4. Test the hypothesis with breakpoints
5. Fix and verify with a regression test