Even better is setting your editor to run JSHint when you save a .js file, and let you know if there are problems. Not only does it avoid stupid bugs, it saves time round-tripping to the browser for trivial issues like syntax errors.
Sounds like a good idea. I know emacs flymake mode can be set up to underline problems detected by jshint. Personally I like to have the tests and jshint run by a hotkey so I can happily move the code through invalid states (towards a valid goal) without being constantly complained at :)
Re:How One Missing `var` Ruined our Launch
by daleharvey on Monday October 31, 2011 @08:05PM
(#3179805)
I wrote a jshint mode for emacs
Re:How One Missing `var` Ruined our Launch
by wahnfrieden on Tuesday November 01, 2011 @12:58AM
(#3180698)
I use jshint in vim as well: https://github.com/wookiehangover/jshint.vim
Re:How One Missing `var` Ruined our Launch
by eric-hu on Tuesday November 01, 2011 @01:59AM
(#3180836)
does this work for coffeescript as well?
Re:How One Missing `var` Ruined our Launch
by philjackson on Tuesday November 01, 2011 @04:31AM
(#3181168)
Unless you use backticks, coffee will always pass jslint tests.
Re:How One Missing `var` Ruined our Launch
by vinnycoyne on Monday October 31, 2011 @09:21PM
(#3180060)
Never heard of JSHint. Thanks for the tip!
Re:How One Missing `var` Ruined our Launch
by simanyay on Monday October 31, 2011 @07:58PM
(#3179785)
Indeed, JSHint is designed to catch those kind of mistakes. Here is the offending code and its JSHint report: http://www.jshint.com/reports/57010
jshint would have caught it. You need to run jshint on your code or you will get silly errors like this. Simple.