I rarely use a debugger and tend to prefer logging, for which I use my own log4javascript. It works consistently in all mainstream browsers, including IE 6 (and in fact IE 5 and 5.5), and by default displays logging messages in a separate console window, which allows you to filter log messages by severity, search log messages (optionally using a regular expression) and more. It can also send log messages to the server using Ajax.
Example 1: Hello world
var log = log4javascript.getDefaultLogger();
log.info("Hello world");
displays
19:52:03 INFO - Hello world
Example 2: Logging an error with a message
try {
throw new Error("Faking something going wrong!");
} catch (e) {
log.error("An error occurred", e);
}
displays
19:52:32 ERROR - An error occurred
Exception: Faking something going wrong! on line number 80 in file basic.html
Example 3: Logging multiple messages with one logging call
var a = "Hello";
var b = 3;
log.debug(a, b);
displays
19:53:05 DEBUG - Hello 3
Example 4: Logging an object
var obj = new Object();
obj.name = "Octopus";
obj.tentacles = 8;
log.info(obj);
displays
19:53:17 INFO - {
name: Octopus,
tentacles: 8
}