Haven't touch javascript for 3 years. Just got a javascript project and wanted to know any new ways or tools emerged these years to debug javascript? I used alert 3 years ago.
I am using IE
Haven't touch javascript for 3 years. Just got a javascript project and wanted to know any new ways or tools emerged these years to debug javascript? I used alert 3 years ago.
I am using IE
Use the Firebug extension for Firefox, or the built-in Web Inspector in any WebKit browser (Chrome or Safari). In IE8, you can use the built-in Developer ToolS.
Dreamweaver as I write it and Firebug for more indepth debugging. alert()s are pretty useful too.
For IE (which I don't suggest using), the latest version (IE8) includes developer tools.
For Firefox, there's an extension called Firebug that has DOM manipulation, a JS console, and more.
WebKit (used in Safari and Chrome) has a built-in Web Inspector that includes a JS debugger, along with a DOM outline and manipulation tools, and a JS console.
You really need a crossbrowser toolkit. Here's mine:
EDIT:
IE 8 added some developer tools, but I haven't used them to any great extent.
EDIT:
If you haven't done JS development in a while I recommend saving yourself a lot of time debugging cross browser issues by browsing the compatibility tables on Peter-Paul Koch's excellent quirksmode site.
I think a Visual Studio / IE8 combo is excellent. Beats Firebug for JavaScript debugging, IMO (and you, of course, use a framework like jQuery to handle crossbrowser issues).
As others have pointed out, most javascript debugging tools come as part of a browser because they are tightly integrated with the Javascript engine itself. This is probably a good thing because you will want to debug each browser separately if you run into a browser-specific quirk.
In the Internet Explorer world, you have two options:
Firebug for FireFox and AJAX Dynatrace for IE http://ajax.dynatrace.com/pages/
I realize I'm answering a question you didn't ask, but have you tried jQuery? It's a javascript library that abstracts a lot of the DOM manipulation stuff for you so you don't have to worry so much about cross-browser compatibility issues. There are other similar libraries out there, but I believe jQuery has the biggest following at the moment. http://jquery.com/
I use Firebug in Firefox every day. In addition to debugging Javascript (and by extension, jQuery or any other js library), it's a great for CSS debugging.
Aptana is a great dev platform that allows you to debug both FireFox and IE.
If you need IE7 debugging, use IE8 in compatibility view with developer tools.
If you use Visual Studio, I highly recommend debugging with IE, despite what others say. When you hit a debugger
statement in IE and you have debugging enabled, you'll get a pop-up to start debugging in Visual Studio.
I don't like Firebug anymore, I don't know where it went wrong, but it's become highly unreliable (ignoring debugger
statements) and really can't compete with VS as far as debugging is concerned.
I use Javascript Debugger plugin to debug errors that are not easy to figure out in firebug. You can set up break points and step through problem area to see variable values..etc. It's a very useful tool.
real programmers use printf() traces for debugging (kidding).
var de =true, bug =console.log||alert||(de=false)
de&&bug( "Enjoy!")
When not in debug mode, just do de=false. Minimal performance penalty