Javascript debuggers: Difference between revisions

From wikinotes
(Created page with "A debugger is builtin to your browser console. = Documentation = <blockquote> {| class="wikitable" |- | MDN: debugger || https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger |- |} </blockquote><!-- Documentation --> = Example = <blockquote> <syntaxhighlight lang="javascript"> // add to your code, this is your breakpoint // (you may need the dev tools/console visible for it to trigger) debugger; </syntaxhighlight> </blockquote><!-- Examp...")
 
 
(One intermediate revision by the same user not shown)
Line 16: Line 16:
// (you may need the dev tools/console visible for it to trigger)
// (you may need the dev tools/console visible for it to trigger)
debugger;
debugger;
// show stacktrace
console.trace();
</syntaxhighlight>
</syntaxhighlight>
there are no console commands to jump for next/step/continue like gdb.<br>
instead you have to use the UI, or use OS-specific hotkeys:
<source lang="yaml">
super '  # next
super ;  # step
super \  # continue
</source>
</blockquote><!-- Example -->
</blockquote><!-- Example -->

Latest revision as of 20:42, 22 February 2024

A debugger is builtin to your browser console.

Documentation

MDN: debugger https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger

Example

// add to your code, this is your breakpoint
// (you may need the dev tools/console visible for it to trigger)
debugger;

// show stacktrace
console.trace();

there are no console commands to jump for next/step/continue like gdb.
instead you have to use the UI, or use OS-specific hotkeys:

super '  # next
super ;  # step
super \  # continue