Wednesday, November 2, 2011

The debugger statement

The debugger statement in JavaScript will cause a debugger (like FireBug or the Chrome developer tools) to pause execution just as if there was a breakpoint at that line.  This is most useful when you have dynamically generated code or whenever you don't have a chance to set a breakpoint on a line before the code executes.  

Simple example:
var a = 44;

In this case the debugger (if open) will pause before the alert is shown.  

Here are the MDN docs for the debugger statement.

1 comment:

  1. No way! Rad. I remember you suggesting I try this a long time ago but I guess I forgot about it. Gotta try it out. :)