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

Exercises

If you want to gain more experience debugging JavaScript programs, try these exercises:

  • Although the number guesser script in Listing 17.3 avoids JavaScript errors, it is still vulnerable to user errors. Add a statement to verify that the user's guess is between 1 and 100. If it isn't, display an alert message and make sure that the guess doesn't count toward the total of 10 guesses.

  • Load Listing 17.2, the number guesser script with bugs, into Netscape's JavaScript Debugger or Microsoft's Script Debugger. Try using the watch and breakpoint features and see if you find this an easier way to diagnose the problem.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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