One thing which is always useful no matter the programming language is to use it in a way that you can get rapid feedback on what you are doing.
The sometimes forgotten Firefox plugin is very useful for quickly creating repeatable scenarios to see the impact that code changes have had.
The beauty of this approach is that it takes out the manual steps in the process, so we can just make our changes and then re-run the test. The runner lights up green or red, taking out the need to manually verify the correctness of our assertions.
AlertThe ‘alert’ function is perhaps most useful when we want to quickly verify the path being taken through a piece of code without having to step through it using the Firebug debugger.
It’s probably more useful for proving our assumptions than actual debugging and it’s certainly quick and easy to set up.