␡
- Introduction
- The Right Tools: A Programmer's Editor
- Simple Debugging
- Using Break Points to Halt Code Execution
- Validating JavaScript
- A Final Note
- Further Reading
Like this article? We recommend
The Right Tools: A Programmer's Editor
The Right Tools: A Programmer's Editor
Whatever platform you work on, and whatever your browser of choice is, it makes sense to have a good code editor. While it's certainly possible to write code in simple programs like Windows' Notepad text editor, a dedicated editor makes life a lot easier.
Many such programs are available, often free of charge under open source and similar licenses. Below I list a small selection of no-cost editors, but look around for one that suits your platform, your working style, and your pocket:
- Notepad++ (Windows)
- JEdit (should work on any platform that has Java installed)
- PSPad (Windows)
- JuffEd (Windows, Linux)
- Geany (Windows, Linux)
Editors offer a range of features and abilities, but as a minimum I would suggest looking for an editor with:
- Line numbering: This is especially useful if you store your JavaScript in external files (and is yet another reason you should do so, wherever feasible). That way the line numbers of any error messages generated by your browser's debugger will usually match those in the source file open in the editor.
- Syntax highlighting: When you become familiar with your editor's scheme of syntax highlighting, you can on many occasions spot coding errors simply because the code in the editor looks wrong. It's surprising how quickly you get used to the colors of keywords, variables, string literals, objects, and so on in your favorite editing program. Many editors let you alter the syntax highlighting color scheme to your own taste.
- Parentheses matching: As an error-seeking missile, parentheses matching is invaluable. Good editors will show matching pairs of open/close occurrences and for all types of bracket, brace, and parenthesis. When your code has several levels of nested parentheses, it's easy to lose count.
- Code completion or tooltip-style syntax help: Some editors offer popup tooltip-style help for command functions and expressions. This can save you having to take your eyes from the editor window to look up an external reference.