Example 1 — Example
Core usage.
JavaScript
function calc(n) {
// debugger; // pauses if DevTools is open
return n * 2;
}
console.log(calc(3));How It Works
- Statement. Invokes the debugger if attached.
- Otherwise. Has no effect.
The debugger statement pauses execution when DevTools is open—like a programmatic breakpoint.
function calc(n) {
// debugger; // pauses if DevTools is open
return n * 2;
}
console.log(calc(3));Core usage.
function calc(n) {
// debugger; // pauses if DevTools is open
return n * 2;
}
console.log(calc(3));CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful