- Get Ready to Program
- What a Computer Program Does
- Common Programming Misconceptions
- Many Programs Already Exist
- Programmers Are in Demand
- The Real Value of Programs
- Users Generally Don't Own Programs
- Giving Computers Programs
- Your First Program
- Clarifying Comments
- Entering Your Own Program
- Summary
- Q&A
- Workshop
Your First Program
The first program that you write will be simple. You may not understand much of it, and that’s fine. The goal here is not to explain the program details, but to walk you through the entire process of the steps that are typical of computer programming:
- Type a program’s source code and save it.
- Load the code document, which is now an HTML document saved to your hard drive, with your web browser and see what happens.
- If the page is not doing what you want and has errors, called bugs, you’ll need to fix those bugs in your source code and repeat these steps. Hour 7, “Debugging Tools,” explains how to locate and fix common bugs. You may need to do some bug hunting earlier than Hour 7 if you experience problems with your programs in these first few hours. If a program does not work as described, you will need to compare your source code very carefully to the code in the book and fix any discrepancies before saving it again.
Starting with JavaScript
You can write your JavaScript code in either your text editor or a word processor. If you choose the latter, you must make sure to save your files as text only. Save your programs with an .html extension, and then when you double click on the file, it should automatically open with your default web browser.