• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Exercises

If you would like to further explore the concepts you learned in this chapter, perform the following activities:

  1. Modify the Greet function to accept two parameters, who1 and who2, and to include both names in a single greeting dialog. Modify Listing 5.4 to use a single function call to the new function.

  2. Add the Average function to the header of a simple HTML document. Add a function call that uses the alert statement to display the average and verify that the result is correct.

  3. Modify Listing 5.6 by removing the var keyword before name2 in the Greet() function. Are the greetings different than the original version? If they are, try to understand why.

  4. Add some additional customizable features to Listing 5.7. For example, you could prompt the user for a URL and include a link on the page.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint