Java Reference
In-Depth Information
18
Common Mistakes, Debugging,
and Error Handling 
What You Will learn in this Chapter:
Spotting common mistakes that everyone makes—even pros!
Handling runtime errors, or exceptions, with the try…catch
statement
Debugging JavaScript with the development tools of various
browsers
Wrox.Com Code doWnloads for this Chapter
You can find the wrox.com code downloads for this chapter at http://www.wiley.com/go/
BeginningJavaScript5E o n the Download Code tab. You can also view all of the examples
and related files at http://beginningjs.com .
Even a JavaScript guru makes mistakes, even if they are just annoying typos. In particular,
when code expands to hundreds or thousands of lines, the chance of something going wrong
becomes much greater. In proportion, the difficulty in finding these mistakes, or bugs, also
increases. In this chapter you look at various techniques that will help you minimize the
problems that arise from this situation.
You start by taking a look at the top seven JavaScript coding mistakes. After you know what
they are, you'll be able to look out for them when writing code, hopefully, so that you won't
make them so often!
Then you look at how you can cope with errors when they do happen, so that you prevent
users from seeing your coding mistakes.
 
Search WWH ::




Custom Search