JSLint is a Javascript code checker that finds common mistakes. It finds problems and returns messages describing the problems and the aproximate line location.
In the website you can validate your code just pasting it into the field and pressing the send button.
JSLint should be used every time you write javascript code.