views:

199

answers:

8

I've notices I'm not capable to debug correctly js. I'm only using alert() as a spread sentences technique but I need something better. So... which tool do you use?

+7  A: 

In Firefox, Firebug and its console which provides a panel for debugging along with an object for programmatically evaluating inside of a script, eg

console.log('test')

Safari and the family of Webkit enhanced browsers have built-in inspectors/consoles.

Opera has Dragonfly.

There are several plugins for Internet Explorer, such as DebugBar and IE8 has a pretty neat built-in Developer Toolbar.

If you're on Linux you can even install spidermonkey-bin, which is the interpreter used by Firefox and invoke it with js in the console.

meder
@Nosredna - doh, thanks!
meder
A: 

Firebug's a must. I've recently also started to use IE8's inner debugging tool and it's pretty nice as well.

m_oLogin
+11  A: 

For Firefox Firebug it's the best, has a lot of useful features, the Console API is great, you can log, make assertions, profiling, timing and much more.

For IE, the Developer Tools of IE 8 is better than nothing, for earlier versions of IE, try the Developer Toolbar.

For Chrome and Safari, check the WebKit inspector and debugging tools.

CMS
+1  A: 

Chrome and IE8 have surprisingly good debugging consoles.

If you use Firefox, you'll need to install Firebug to compete.

Cory Petosky
Chrome and Safari share the Webkit debugging. They are getting better very quickly.
Nosredna
+1  A: 

For cross-browser logging you could use log4javascript.

Tim Down
+1  A: 

Firebug is very good. However, if you are on Windows you should check out the Developer Tools in IE 8. The integrated debugger allows for breakpoints and uses a lot of great elements probably taken from Visual Studio concepts. You have an interactive console, etc. You can get to it using F12.

SnapShot
I work on Linux. Thanks anyway.
Juanjo Conti
A: 

To track down performance issues:

Gregory Pakosz
Is it a debugger, or an optimizer?
Nosredna
well yeah, it's more a profiler - not a step debuggerbut it gives you traces which can be used for debugging purposes
Gregory Pakosz
A: 

Firebug lite is also good in a pinch

couchoud