Show-n-Tell Thursday

Automatically launching Javascript Debugger from code

I'm trying to locate a very odd javascript problem at the moment but not having much luck. However, in my browsings I have found a very useful little line which makes debugging a lot easier. If you enter the line "debugger" in your function then if you have the IE Script Debugger or the Venkman debugger installed then then will fire up when that line is executed and allow you to continue from that point onwards. Effectively you have the ability to set break points in your code, very useful I think you'll agree.

So your code will look like this...
function foo() {
var bar="";
debugger; //your script debugger will launch when this line executes
for (var i=0; i //Some code goes here

Technorati Tags: Show-N-Tell Thursday