Enable Java script Debugging

Enable Javascript Debugging

When I start learning java-script , I found it difficult to work as I don’t know how to debug it as I was very much familiar with Visual Studio (2005, 2008 , 2010) debugging modes.
So I start searching and after some googling and reading I found that there is tremendous method available for java script debugging in all Visual Studios Versions.
Here is Step wise tutorial to do that

Javascript Debugging


1. First of all make a small script in an external js file . Always prefer to make isolated js files instead of mixing it with your php or aspx page . As Isolating client side code with design and server side and it is highly preferred and developer can keep eye on the un-necessary calls.
Say I make a file name testFile.js in which i write a simple function.
function testFunction()
{
    var a = 10;
    var b = 20;
    var c = a + b;
    alert(c);
}
2. Right Click in Internet Explorer (any version) go to internet options or Options. > Advance 
UnCheck “Disable Javascript Debugging.” , Remove checks on two lines as below
3 . Come back to your project that contains your external js file . Right click on your Project solution a menu appears click on “Browse with”
4. A dialog appears asking for Browser , choose Internet Explorer to browse with

5. Put a break point in you javascript file , by clicking on left side of script.

6. Call your function at any place in your index.html or from any where like button click or onload etc , I call it on body onload (always remember to include the reference of external js file on top of your php , aspx or html page.)
7. Then you will see that break point is highlighted and you can use all windows of VS like watch window , immediate window for visualizing all functions input output parameters , variable values.

Thats all enjoy , happy programming !