My background is mainly strongly typed languages (java, c++, c#). Having recently gotten back to a bit of javascript, I found it a bit annoying that if I misspell something by accident (for example I'll type 'myvar' instead of 'myVar') my entire script crashes. The browser itself most of the time doesn't even tell me I have an error, my program will just be blank, etc. Then I have to hunt down my code line by line and find the error which is very time consuming. In the languages I am used to the compiler lets me know if I made a typo.

My question to you is, how do you overcome this issue in scripting (javascript)? Can you give me some tips? (this question is mainly aimed at people that have also come from a strongly typed language).

Note: I mainly use the terminal/VIM ... this is mainly b/c I like terminal and I SSH alot too

  • argh.........;)
    – user19718
    Mar 13, 2011 at 1:38

5 Answers 5


Most browsers should have options to allow you to turn on javascript errors... I've been away from web development for a little bit so I haven't looked recently. If you use Firefox (or are willing to) there is a plugin called Web Developer Tool bar that is GREAT for things such as javascript and css debugging.


The right solutions are generally to have unit tests, and to use some linting program.

With JavaScript I can recommend http://closuretools.blogspot.com/2010/08/introducing-closure-linter.html for the latter. You'll have to code your JavaScript according to the Google Style Guide, but that's not a particularly bad style guide for JavaScript.


You should really try out a unit testing framework for Javascript. It will catch a lot of these irritating errors that you can spend a lot of time chasing down.

I'd recommend Jasmine: http://pivotal.github.com/jasmine/


Have you tried eclipse? I have seen the type of capability that you are talking about in it. The plus is that you can download plugins for multiple languages to give you what you are asking for. When I have used it in the past it almost feels like Word spell/grammar check is running and underlining the suspicious pieces of code.

Personally I have seen it help with Java/Python/C++.

Also you might want to go look for a lint program for the language you are using. They traditionally find a lot of these types of errors.


JavaScript makes up for the errors you mentioned by being very interactive and easy to test so whenever the program comes tumbling down it does so pretty quickly and painlessly so in practice it is not a very big issue. So whenever you write a few lines fire up the browser and see what happens. My tool of choice is firebug on firefox but any other developer tool offered by the other browsers would work as well. I basically write all the code from the firebug console by testing bits and pieces as I go along. It's been working pretty well so far.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.