Is debugging JavaScript as easy as debugging a C++/C#/Java application (given the best IDE available), or are the current tools much more limited and less user friendly, making debugging a headache?
Is debugging JavaScript as easy as debugging a C++/C#/Java application (given the best IDE available), or are the current tools much more limited and less user friendly, making debugging a headache?
Share Improve this question asked Aug 27, 2009 at 13:43 Dimitri C.Dimitri C. 22.5k21 gold badges90 silver badges103 bronze badges 1- You ask silly questions. Just start learning Javascript by reading a tutorial and quit being a chicken! – Josh Stodola Commented Aug 27, 2009 at 14:35
7 Answers
Reset to default 3With Addons in FireFox (FireBug, GreaseMonkey to name a few) along with support from IDEs like Visual Studio, it makes it pretty easy to debug javascript. Is it as "easy" as Java, C#, etc. I think that is really depends from programmer to programmer. I know a lot of programmers who think programming and debugging JavaScript is the most terrible thing in the world, eventhough they have all the tools available to them. To me, it doesn't seem so difficult, but I started programming JavaScript when there were no tools to help debug it. Like many things it's all a matter of perspective.
The Firebug plugin makes debugging JavaScript fairly easy- I'd say at least on par with debugging a C# application.
A key point that the answers so far have missed is that unlike C++/C#/Java you get far less help at "Compile" time.
Hence a Javascript debugging session will often involve a considerable amount of time discovering a set of bugs that would be picked up very quickly and easily by the others before anything has run at all.
So the answer is a clear no, its harder to debug javascript than the other languages listed.
In Visual Studio 2008, there's pretty good support for debugging JavaScript... breakpoints work, and you can hover over variables to see their values, etc. It's the best way to debug JS that I'm aware of.
I find it to be rather painless with Firebug. It es with a full blown debugger. However, I find dynamic languages to be more difficult to debug if they make heavy use of closures and functional abstractions.
Firebug brings JS out of the stone age but isn't as elegant as debugging .NET. PC development tools leverage maybe 10 years extra evolution...
No, JavaScript is horribly sloppy language. You have to use a tool such as Firebug or JSLint to help you debug or you may never find your problem in a large application.
Here is some of why JavaScript is so problem prone:
- Undeclared variables inside a function are global scoped by default.
- JavaScript allows sloppy line breaks and attempts to insert semicolons where it thinks they are missing at pile time. This can wreck your code.
- JavaScript has problems with type parison when using equality parison "==". You have to use "===" type of equality parison or "!==" type of inequality parison to get around those problems.
- JavaScript has many more problems that any well written language would not have. I remend reading the book The Good Parts to avoid many traps and write programs that beautiful, efficient, and maintainable.
http://jslint./