sajad torkamani

In a nutshell

A debugger is a program that lets you set breakpoints in your source code so that the execution of code pauses / “breaks” at those points. At each breakpoint, you can inspect the scope and call stack of your program.

This can help you better understand the code execution flow (by inspecting the call stack) or how the values of variables change over time (by inspecting the scope at each breakpoint),

Most programming languages or IDEs provide a built-in debugger or you can usually find a popular community tool. Examples include:

See this Chrome DevTools reference to get an idea of what a debugger can do.

Key terms / jargon

TermDescription
BreakpointA location in your code where you want the debugger to halt execution so you can inspect the state of your program at that execution point. For example, you can view the local scope of a function, the global scope, any closures (if applicable to the programming language), or the call stack that led to the current breakpoint.
Call stackThe series of functions that were called to reach the current line. Being able to see the call stack any given point is very useful when you want to know how you got to a particular execution point.
FrameAn entry (function) in the call stack.
ScopeThe list of variables and their values at the current breakpoint.