views:

1583

answers:

8

Not sure if there is any Firefox add-on tool for checking JavaScript syntax, var declaration, or even pre-compiling available?

I find out is very difficult to debug JavaScript in a web html page. I have to add some script there. When the scripts get very big or long, it stops working. Basically, there must be some bugs. It is very frustrating even the load event stop working. I do need some good tools to find out the bugs.

I have tried FireBug. It is good but not enough. Maybe I don't know all its features. Anyway, I need any good suggestions.

+5  A: 

This page may help you a bit as it also contains a screencast.

Debugging Javascript in Firefox with Firebug

Codeslayer
+1  A: 

As an alternative to FireBug check this debugger: Venkman JavaScript Debugger, has been out there for a while, and it's not bad at all...

CMS
+1  A: 

I have always been a firebug fan and it sure is one of the best debuggers out there. Any JS issue Press F12, Enable the console for catching the errors and then you can find the exact line causing the error. Add a breakpoint and you can see the exact values of variables too. Very intuitive UI..just get used to using it and it will save a lot of your time.

sarego
+3  A: 

It's not strictly an Add-On (although you can obviously run it in a Firefox web page), but I've found JSLint to be helpful in exposing expression anomalies that might or might not be strictly invalid syntax (although it will catch all those, too.)

le dorfier
+1  A: 

I HIGHLY recommend Rainbow. It's still in Beta and only works in FF3, but it offers syntax highlighting. That will get you half-way there when it comes to syntax.

Atømix
+2  A: 

My suggestion is to check you javascript with JSLint. JSLint will show you common problems in javascript code and helps you to create strict and compatible code.

YSlow includes JSLint as Tool.

Joe Scylla
+1  A: 

I constantly use firebug with a js file that has some 15000 lines. I've had no problems with it (sometimes I have to wait a few seconds for it to scroll to the breakpoint but even then it works fine).

Unfortunately JSLint does'nt work for us. We use some third party code that while beeing "valid" has unnecessary ";" according to jsLint. The code is in the beginning of our js file and jslint stops analyzing at 3% because it thinks there are too many errors (all of them unnecessary ";".)

Gene
Why don't you separate your script into different files at least in development mode? That way it would be easier to debug the code and even allow you to use JSLint.
Damir Zekić
Yeah if I really wanted to I could do it. It's too much of a hassle though. We have automated "publishing" system in place and it would be a lot of manual work to separate publish and test all our files all the time (you may call me lazy if you want). The debugging works fine so thats no issue.
Gene
A: 

Hi Gene: you could change one varialbe option.maxerr inside your jslint.js file into the number you want.

The default value is 50, you could change it to 500 or 1000 to suite your taste. Rgds Cuong Huy To

CuongHuyTo