"JSLint is a JavaScript program that looks for problems in JavaScript programs."
It will analyse your javascript, and point out errors, problems and even possible improvements. As it utilises a stricter sub-set of the ECMAScript Specification, it might even help you improve your scripts.
JSLint