Debugging with DevTools
Debugging compares a program’s actual execution with its intended behavior. Breakpoints pause execution so you can inspect bindings, the call stack and the next instruction.
Form a testable explanation for the failure, inspect the relevant state, then verify the repair against a boundary case.
See the mechanism
minutes <= 5 should be shortFollow one example
The product rule is "at most five minutes", but the function returns false for 5. With developer tools attached, pause and inspect minutes before the comparison, then step over it. Without a debugger attached, the statement normally has no visible effect. The HTML and console editors may run in an isolated frame or worker; select that execution context when inspecting sources.
Predict, change and check
Predict: If the rule includes exactly five, is changing the test data a repair for the condition?
Test your explanation: Replace < with <=, remove the debugger statement, and test 4, 5 and 6. Save the boundary test so the same bug is caught later.
The tasks below ask you to explain that result and apply the idea to different inputs.
Apply and distinguish
Inspect the frame that owns the mistake
Set a breakpoint near the incorrect decision, reproduce the smallest failing input and inspect local bindings in the relevant call frame. Step over a call when you only need its result; step into it when the fault may be inside it. Conditional breakpoints can focus a repeated loop on the failing record.
A debugger statement in the course worker must be inspected in that worker's execution context. A page example has a different frame. Record a hypothesis, the observed values and a repaired boundary test. Changing an input until it stops triggering a bug is not a verified repair of the program.
Check your understanding: State the input contract, identify the operation that changes the result, and give one boundary input that would distinguish the correct rule from the mistake described above.