JavaScript Logging

A List Apart has a really useful article to help with debugging Javascript.
A List Apart: Articles: JavaScript Logging

If you spend any time working with JavaScript, eventually will come a day when you need to know the value of a variable (or an object’s field) as the execution of the script progresses, or why a script terminates unexpectedly (this is a really great way to go crazy). If you are working with simple scripts, you can accomplish this with JavaScript’s alert() function, which instructs the browser to create a dialog box with the argument set as the box’s caption. The message can be anything that helps you understand your script’s operation.

Several browsers include tools , including those from Opera and the Mozilla project. The Mozilla browsers and recent versions of Opera include JavaScript consoles that can aid in debugging your code and assist script authors in finding the error that caused a script to terminate unexpectedly.

Anyway go and read the article. It’s a godsend.

Published

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.