Debugging JavaScript: an ASP.NET developer’s approach

As an ASP.NET developer I’ve always been averse to writing JavaScript. One of the reasons I shied away from writing JavaScript was because of my difficulty in debugging the code. Tossing in alerts to find errors in the code was always too reminiscent of the time I spent writing code before finding a decent IDE. Well for ASP.NET developers working in Visual Studio, there are great tools available to help you debug JavaScript. Microsoft details the methods here and here. The method I use is to simply pull up the running documents window and work from there. This gives you the standard Visual Studio debugging windows like Locals, Watch, and Command. You also get the added advantage of not having to jump into a different debugging environment when going from client side to server side code.

One of the problems I’ve found with this method is that it is IE centric. If I’m developing code that needs to work on Firefox in addition to IE, I need to use other debugging tools. Mozilla’s JavaScript debugger is code named Venkman. It’s fully featured and you have to love the Ghostbusters reference! Venkman has all the standard debugging features including Locals, Watch, and Command windows. One issue with this method is that you have to pull up the web page in Mozilla or Firefox and you’re debugging only the client side of the application. In order to debug the server side code at the same time you’ll need to attach the VS debugger to the server side process as detailed here.

The web applications I currently write have no requirements to support users of other browsers so I’m not sure what is available for those. What tools have you found for writing and debugging JavaScript that have made things easier?

Wow, I didn't know

I will check out your links,and nothing is as worse as a screwed up JS. I use Firefox javascript Console to debug for both IE and Firefox if possible. Unfortunatly, doesn't always work to find errors in IE.