Tools for the JavaScripter!
As you already know, JavaScript doesn't require you to go to your software retailer and buy expensive software to write JavaScript. However, two different kinds of software exist that will let you do the job.
Let's look at these now.
The Simple Text Editor
Probably the best option is choosing a simple text editor (such as faithful old Windows Notepad) and typing in the code this way. Writing JavaScript this way might be the "hard way" to write JavaScript, but it has some cracking advantages:
It's cheap!
You don't need to learn how to use a complex piece of software.
You actually learn JavaScript, as opposed to learning how a software package works.
It frees you from the JavaScript techniques built into the software package. By writing the code yourself, you can do anything and everything that JavaScript enables you to do.
You're free to format and add notes and comments to the JavaScript as you see fit. You know how it all works, so making changes to the JavaScript is easy.
You can keep all the little snippets of JavaScript that you write, building up your own JavaScript library.
You have the satisfaction that the JavaScript is all your own work, and you can take all the credit for it!
CAUTION
Don't be tempted to use a rich text editor (such as Microsoft Word or Windows Write) to write JavaScript, because problems can result. A common problem is quote marks. JavaScript requires plain quotes (' or ''), whereas certain rich text editors have a tendency to use curly "smart quotes." These simple, curly smart quotes can cause big problems. The best way to avoid these problems is to use a simple text editor.
Using Visual Tools
Visual tools for writing JavaScript are usually HTML editors/creators that enable you to drop into the Web page simple scripts to perform simple tasks. Examples of such tools include Microsoft FrontPage, Macromedia Dreamweaver, and Adobe GoLive.
Usually, you don't even have to look at or type in any JavaScript at all, which on the face of it might seem like a good idea. But what they offer in terms of ease of use, they lose in terms of flexibility. Each tool is usually limited to a few JavaScript tricks in its repertoire, so the scope for creativity is somewhat limited. Another drawback is that the JavaScript outputted by these visual tools is usually so long and complicated that even professional developers find it difficult to read, let alone make changes to or edit, the script. It is not unusual for one small edit to cause the whole JavaScript to stop working and throw up errorsnot a good thing to show the visitors to your site!
However, there might be times when you need to or have to use a visual tool. That's OK. The main thing is that you will be able to write your own JavaScripts when you want to and not have to rely solely on the built-in scripts in the software.
However, some advantages do exist to using visual tools:
SpeedThey are much faster to use than manual typing.
AccuracyIf allowed to do its own thing, visual tools output JavaScript that works (however, this might not be the case once you start to modify it!).
Special featuresFeatures such as color-coding of the HTML make the HTML and JavaScript more readable.
TIP
When working through examples in a book, we encourage you to actually type out the examples for yourself.
Although this might seem tedious and time-consuming, it is by far the best way to learn how to write and, more importantly, how to think, in JavaScript. This enables you to get a feel for how the language actually comes together.