20.10. JavaScript Errors and Troubleshooting
Although JavaScript syntax is fairly straightforward, it is incredibly easy to make mistakes that cause your scripts not to function the way you intend. This section will provide some troubleshooting tips to aid you in solving your scripting problems.
20.10.1. Using the Right Tools
First and foremost, using an editor designed to edit code is essential. Although any text editor will work, code-friendly editors offer features such as auto-indenting, syntax highlighting, and regular expression search-and-replace functions.
Some of the tools in the following list are open source and others are commercial. Most of the commercial applications offer free trial versions. Capabilities between the various editors vary — pick an editor that offers the capabilities you need in the price range that works for you.
Windows users should explore tools such as the following:
TextPad — http://www.textpad.com
PSPad — http://www.pspad.com/
Homesite — http://www.macromedia.com/software/homesite/
Linux users should explore tools such as the following:
vim — http://www.vim.org/
Bluefish — http://bluefish.openoffice.nl/
Macintosh users should explore tools such as the following:
Many of the editors available for Linux (see preceding list)
BBEdit — http://www.barebones.com/index.shtml
Dreamweaver — http://www.macromedia.com/software/dreamweaver/
20.10.2. Common JavaScript Syntactical Mistakes
There are several ...
Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.