Using debugger Statement (Manual Control) :
function testFunction() {
debugger; // Execution will pause here
console.log("This is a test");
}
-
Insert the debugger statement in your JavaScript code where you want execution to pause.
-
Open Chrome DevTools and run your code. The debugger will pause at the debugger statement, allowing you to inspect variables and step through the code.
The debugger statement is a quick way to stop code execution and start debugging without manually setting breakpoints in DevTools.