Home > Articles > Web Development

  • Print
  • + Share This
This chapter is from the book

Workshop

The workshop contains quiz questions and exercises to help you solidify your understanding of the material covered. Try to answer all questions before looking at the “Answers” section that follows.

Quiz

  1. When a user views a page containing a JavaScript program, which machine actually executes the script?

    1. The user’s machine running a web browser
    2. The web server
    3. A central machine deep within Netscape’s corporate offices
  2. What tool do you use to create and edit JavaScript programs?

    1. A browser
    2. A text editor
    3. A pencil and a piece of paper
  3. What are variables used for in JavaScript programs?

    1. Storing numbers, dates, or other values
    2. Varying randomly
    3. Causing high-school algebra flashbacks
  4. What should appear at the very end of a JavaScript script embedded in an HTML file?

    1. The <script type="text/javascript"> tag
    2. The </script> tag
    3. The END statement

Answers

  1. a. JavaScript programs execute on the web browser. (There is actually a server-side version of JavaScript, but that’s another story.)
  2. b. Any text editor can be used to create scripts. You can also use a word processor if you’re careful to save the document as a text file with the .html or .htm extension.
  3. a. Variables are used to store numbers, dates, or other values.
  4. b. Your script should end with the </script> tag.

Exercises

  • Add a millisecond field to the large clock. You can use the getMilliseconds function, which works just like getSeconds but returns milliseconds.
  • Modify the script to display the time, including milliseconds, twice. Notice whether any time passes between the two time displays when you load the page.
  • + Share This
  • 🔖 Save To Your Account