Tuesday, July 3, 2007

Javascript debugger

Here are a few tips to debug a javascript code

1.Use alert statement to check the values of the variables.
2.Use firefox javascript debugger option to check for javascript errors.
3.IE also provides with the error status which gives you the line number where the error occured.
4.One of the best ways to debug is using the visual studio.If you have visual studio installed write a 'debugger;' statement to set the breakpoint in the javascript code.When the execution reaches this code ,the visual studio prompts you to attach the debugger to this code.You can do a line by line debugging and also check for variable values by this method.

2 comments:

Vishal Naik said...

Check out this firefox plug in
https://addons.mozilla.org/en-US/firefox/addon/1843

and IE toolbar

http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en

both are excellent debuggers for Javascript/Ajax

Siva said...

Thanks it was very useful