I agree I just had to rage for a second. At some point, I'll have to learn to into TDD or just start using sanity checks liberally (because I've lost mine)
I write a lot of JavaScript and one thing that helps me is using Firefox Developer Tools or the Chrome Developer Tools. Usually you will get a decent error message, although it's not perfect. Another thing to check out is a framework (like Backbone.js) - it'll make your life so much easier in the long run. Also, JavaScript kind of has it's own take on traditional design patterns, which I use frequently. Addy Osmani has a free book that has proven to be invaluable for me - http://addyosmani.com/resources/essentialjsdesignpatterns/bo...