Appendix C. Answers to Tutorial Exercises
This appendix provides answers to the tutorial exercises that appear in Part II of this book (Chapters 4 through 12).
Chapter 4 Answers
The catalog page (a) and temperature calculator (d) are good client-side JavaScript applications. Even though the catalog relies on server storage of the image files, you can create a more engaging and responsive user interface of buttons and swappable images. The temperature calculator is a natural, because all processing is done instantaneously on the client, rather than having to access the server for each conversion.
The Web site visit counter (b) that accumulates the number of different visitors to a Web site is a server-side application, because the count must be updated and maintained on the server. At best, a client-side counter could keep track of the number of visits the user has made to a site and report to the user how many times he or she has been to the site. The storage requires scripting the cookie (see Chapter 16). A chat room application (c) done properly requires server facilities to open up communication channels among all users connected simultaneously. Client-side scripting by itself cannot create a live chat environment.
Valid, because it is one contiguous word. InterCap spelling is fine.
Valid, because an underscore character is acceptable between words.
Not valid, because an identifier cannot begin with a numeral.
Not valid, because no spaces are allowed.
Not valid, because apostrophes and ...
Get JavaScript® Bible, Sixth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.