Debug Javascript in a funny way

Debugging the javascript code is possible, we don't require any special IDE for debugging, Visual Studio is quiet suffcient. There are two methods to achieve it.
Before starting the debugging process, enable debugging in Internet explorer. we can do that from Internet options.
  • Open Internet option dialog box.
  • Select Advanced tab.
  • In Browsing group, uncheck the Disable script Debugging (Internet Explorer) check box
  • Also the uncheck the Check box next to that for other browsers.
Method One : Write the javascript part in a separate js file, and use the Braek point. so when you run the application, the debugger will prompt near the Break point.

Method Two : Write a line of junk code before one line of your required Break point, when you run the code, it prompts for the error and confirms with you for debugging, click yes and it point to the junk line of code, move the cursor to the next line and use the VS IDE in Break mode as usual.

In VS Debug Mode, we can use the immediate widow and visualize values for varables. But the watch functionalies will not work, but still the intellisence browser will work in VS2005, so that we can explore the objects and their members easily.

To avoid this ODD way, we have wait for the VS 2008 release. The New Javascript Debugging and also our favorite Intellisence is added for javascript also in that edition.

No comments:

Post a Comment