If you use firebug like I do you tend to add a large amount of console.log’s into your code to check the values of certain things during execution or to get links to objects so you can check out their contents in the dom viewer. You might also add the debugger keyword into your code to break at a particular spot so you can check several variables at that point in execution.
This involves adding the console.log entries into your code, saving the file then refreshing the page and navigating back to point of execution to see your new entries in the logs.
Wouldn’t it be nice if you could add arbitrary code at a particular point in the script via Firebug?.. You could add several logging calls at a particular execution point then click the button to execute it and see what you get.. no need to to modify the code, save it, refresh the page, etc. Well there is, in fact, a way of doing this. It’s a bit of a hack but that just adds to the fun.
As you may know, Firebug has conditional breakpoints. You can set a breakpoint and then right click this breakpoint to display a text field in which you can add a conditional. If this conditional is true the breakpoint fires and code execution stops. So the way it works is firebug executes the code you’ve entered into the conditional breakpoint and if it returns as true then it breaks execution at that point. The trick here is that firebug executes the code.. so you can execute any code you want at this point and as long as it doesn’t return a truthy value then it won’t break.
You can execute console.log for example.

The code you enter into the conditional field executes within the scope of the code at which the breakpoint is set so you can log things, modify things, etc. at that point in execution. Neat huh?