All JavaScript implementations implement a debugger statement, which can be called at any point in your script. Also we have console.debug in Firebug.
Apart from being an elegant debugger, FireBug offers the developer hooks that can be used from JavaScript, offering logging, assertions, performance measuring, and command line functions for inspection or traversing a document.