All JavaScript implementations implement a debugger statement, which can be called at any point in your script. Also we have console.debug in Firebug.
Douglas Crockford's presentation on Advanced JavaScript. He covers topics such as inheritance, modules, debugging, efficiency and JSON.