JavaScript Debugging

A debugging tool is essential for JavaScript development. Firefox provides a debugger via the Firebug extension; Safari and Chrome provide built-in consoles.

Each console offers:

  • single- and multi-line editors for experimenting with JavaScript
  • an inspector for looking at the generated source of your page
  • a Network or Resources view, to examine network requests

When you are writing JavaScript code, you can use the following methods to send messages to the console:

  • console.log() for sending general log messages
  • console.dir() for logging a browseable object
  • console.warn() for logging warnings
  • console.error() for logging error messages

Other console methods are also available, though they may differ from one browser to another. The consoles also provide the ability to set break points and watch expressions in your code for debugging purposes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s