Java Reference
In-Depth Information
Using the Console
Most modern browsers have a console object that provides a number of methods for log-
ging information and debugging. It is not part of the official ECMAScript specification, but
is well supported in all the major browsers.
• The console.log() method can be used to log the value of variables at differ-
ent stages of the program, although it will not actually stop executing the program.
• The console.trace() method will log an interactive stack trace in the con-
sole. This will show the functions that were called in the lead up to an exception
occurring while the code is running.
This SitePoint post also lists a few other useful but little-known methods of the console
object.
Debugging Tools
Most modern browsers also have a debugging tool that allows you to set breakpoints in
your code that will pause it at certain points. You can then see the values of all the variables
at those points and modify them. This can be very useful when trying to track down bugs.
Here are the links to the debugger documentation for each of the major browsers:
Firefox
Internet Explorer
Chrome
Safari
Search WWH ::




Custom Search