How do you see JavaScript code in Chrome and use the debugger for debugging?

Using debugger Statement (Manual Control) :

function testFunction() {
  debugger; // Execution will pause here
  console.log("This is a test");
}
  1. Insert the debugger statement in your JavaScript code where you want execution to pause.

  2. 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.