Today Ray Camden posted an entry on how he finds and fixes JavaScript errors.

For me, I use FireFox for my initial testing and debugging of code. I like firebug plugin for FireFox. Chrome has the same thing now and that is what Ray is using in his post.

Even though these tools are very useful for finding easy problems, they don't help much with other things. For example I was working with some cf form ajax components and in the form onSubmit() i was getting an error (_b.value is undefined). I was using the validation with cfinputs.

There are no tools to help fix this issue that I know of, the only way I know to find these kinds of problems is comment out one line at a time till the error stops then back up and try again using the console to write out variables. Other times the error is thrown inside of a minified (compressed javascript file) file. Most of the time its a syntax error on your end that is causing the error, but again there is not much you can do. One approach is to use the debuggers inside of Chrome / FireFox (firebug) and even the flaky one for IE. This will (as Ray points out) let you step through your code, one line at a time, until it hits the error. Then you simply go to the line just before the error happens to look for the problems. And the other way is again to comment out and write to the console.

Hopefully this is helpful to some of you