★ wanayoo — archive 1999 http://webdeveloper.com/javascript/js_heidi_debug_3.htmlNouvelle recherche | Portail wanayoo
internet.com
Library
Magazines

webreference.com

Java Boutique

Search Engine Watch

PC Webopedia

The Web Developer's Virtual Library

All Net Research -- in one place Library

JavaScript Programming: Debugging Part III

by Heidi Brumbaugh

More Tips, cont.

  • Take small steps. Test your program each time you make a small addition or modification. Back up working versions of a script, so that if difficult errors creep in you can easily go back a step.
  • If the browser doesn't seem to be responding to your changes, make sure your files are in sync. Did you save a backup to a different folder, then make changes and forget to save the new version out to the original name? I hate it when that happens.
  • Check and double-check your spelling. The browser will notice if you misspell a keyword, but not if you misspell one of your own variable names. JavaScript allows implicitly declared variables, which means it will treat the second word as a new variable.
  • Also, use consistent style for variable names, and remember that JavaScript is case sensitive. If you always begin variables with lower case letters, you're less likely to slip up and use upper case instead.
  • Finally, add debugging statements. These are statements that tell you what is happening inside the program, what the variables are at different times, and so on. They can be invaluably helpful. Note which lines are debugging statements so you can find and remove them easily when the program works.

Flash!

Be sure to check out Netscape's DevEdge documentation site at http://developer.netscape.com/library/documentation/index.html, especially if you've been using JavaScript documentation that's cached on your hard drive. Netscape has very recently updated its core JavaScript documentation. Now you can read all about the latest changes and feature additions.


Heidi Brumbaugh has been a writer and editor in the computer publishing industry for ten years. Feel free to visit her home page.
Web Developer® Site Feedback
Web Developer®
Copyright © 2000 internet.com Corporation. All rights reserved.

http://www.internet.com
Web Developer® Home Over a dozen topics in detail Live Chat Downloads Book and Product Reviews Threaded Discussions How-To/Articles/Links Developer Daily News Subscribe Search Corporate Information Advertise Events Publications internet.com Home