To further your knowledge of JavaScript and loops, perform the following exercises:
Modify Listing 7.2 to sort the names in alphabetical order before displaying them. You can use the sort method of the Array object, described in Hour 5, “Using Strings and Arrays.”
Modify Listing 7.2 to prompt for exactly 10 names. What happens if you click the Cancel button instead of entering a name?