Chapter 11

11.1 Fill in the blanks in each of the following statements:

  1. Because JavaScript uses objects to perform many tasks, JavaScript is commonly referred to as a(n) object-based programming language.
  2. All objects have attributes and exhibit behaviors.
  3. The methods of the Math object allow you to perform many common mathematical calculations.
  4. Invoking (or calling) a method of an object is referred to as sending a message to the object.
  5. String literals or string constants are written as a sequence of characters in double quotation marks or single quotation marks.
  6. Indices for the characters in a string start at 0.
  7. String methods indexOf and lastIndexOf search for the first and last occurances of a substring in a String, respectively.
  8. The process of breaking a string into tokens is called tokenization.
  9. String method link formats a String as a hyperlink.
  10. Date and time processing can be performed based on the computer's local time zone or on World Time Standard's Coordinated Universal Time (UTC).
  11. Date method parse receives as its argument a string representing a date and time, and returns the number of miliseconds between midnight, January 1, 1970 and the specified date and time.

11.7 Write a script that uses random number generation to create sentences. The program should generate 20 sentences to form a short story and output the results to an XHTML textarea. The story should begin with a line reading "Once upon a time..." and end with a line reading "THE END."

11.21 Write a program that reads a five-letter word from the user and produces all possible three-letter words that can be derived from the letters of the five-letter word.

11.22 Write a script that reads a date from an XHTML form and creates a Date object in which to store it. Then use the various methods of the Date object that converts Dates into strings to display the date in several formats.

Home