Along the way you'll learn:
To understand how to update the date and time on the page, you'll first have to learn about variables, strings, and functions. Your homework assignment at the end of this chapter will be to figure out how to add seconds to the time.
The first word, var, introduces a variable for the first time, you don't need to use it after the first instance, no matter how many times you employ the variable in the script.
NOTE: Many people don't use var in their code. Although most browsers let you get away without it, it's always a good idea to put var in front of a variable the first time you use it. (You'll see why when I talk about writing your own functions in Chapter 6.)
If you name your variables descriptively, your code will be easier to under stand while you're writing it, and much easier to understand when you return to it later for revision or enhancement. Also, no matter which programming language you use, you'll spend about 50 percent of your coding time finding and getting rid of your mistakes. This is called debugging--and it's a lot easier to debug code when the variables have descriptive names. You'll learn more about debugging in Chapter 14.