I can't find great way to debug javascript. I know firebug on firefox, but it's not best way I think. I want to put break point and trace program but I can't with it. Do you know good tool or how to trace the program.
-
9You can put break point and trace in Firebug.– FopfongCommented Jun 18, 2010 at 7:20
-
2Firebug facilitates everything you've just listed. Under the script toolbar, you can add breakpoints and step through your program. Also, inside your code, throwing things into console.log is extremely helpful.– Jamie WongCommented Jun 18, 2010 at 7:22
-
5You could have searched stackoverflow: stackoverflow.com/questions/988363/… stackoverflow.com/questions/1739221/… and several others, in fact.– Greg SCommented Jun 18, 2010 at 7:24
6 Answers
I believe this is what you're looking for:
http://weblogs.asp.net/scottgu/archive/2007/07/19/vs-2008-javascript-debugging.aspx
N.S.
Firebug Extension for Firefox (Yes, it also supports breakpoints) or the Webkit Inspector that's built into Safari and Chrome by default.
Both offer JavaScript debugging/profiling and a lot of other useful features.
I find IE 8 Developer Tools (built into IE 8) and Visual Studio (2008, Express is free) are an excellent way to debug JavaScript -- at least in an environment compatible with the above tools :-)
-
considering, that IE8 is ... IE8 and that VS is rather heavy (ok, maybe not for most ppl out there), and also that IE + VS is basically solution for Win OS only (we don't know which one OP is working on) - this solution is not a good choice. I have IE8 and VS2010, but I can't live without firebug extension, when it comes to web dev (OP simply couldn't find the right tools) Commented Jun 22, 2011 at 20:42
-
Seriously, I'm not sure why I got a down-vote. Please read the full answer "at least in an environment compatible with the above tools" -- in which case, my answer is as good as any, even if you are a Firefox/Firebug supporter.– user166390Commented Jun 23, 2011 at 5:14
-
it's not mine down-vote. I know that your answer is a solution, but not for everyone (what probably is the reason behind this down-vote) Commented Jun 23, 2011 at 7:31
Add the snippet debugger; in your javascript code that will allow you to debug on the browser console
function myFunction(){
//Some stuff
debugger; //Debugging is automatically started from here
//Some stuff
}
myFunction();