Found this on AListApart.com

It was amazingly valuable for debugging JS.

Safari also has a javascript debugger. You need to enable the Debug menu in safari, which can be done by typing the following into terminal (make sure safari is closed):

% defaults write com.apple.Safari IncludeDebugMenu 1

Then relaunch safari, and from the debug menu you can open a js console.

Amazing.