21
Error Handling and Debugging
WHAT'S IN THIS CHAPTER?
- Understanding browser error reporting
- Handling errors
- Debugging JavaScript code
WROX.COM DOWNLOADS FOR THIS CHAPTER
Please note that all the code examples for this chapter are available as a part of this chapter's code download on the book's website at www.wrox.com/go/projavascript4e
on the Download Code tab.
JavaScript has traditionally been known as one of the most difficult programming languages to debug because of its dynamic nature and years without proper development tools. Errors typically resulted in confusing browser messages such as "object expected"
that provided little or no contextual information. The third edition of ECMAScript aimed to improve this situation, introducing the try-catch
and throw
statements, along with various error types to help developers deal with errors when they occur. A few years later, JavaScript debuggers and debugging tools began appearing for web browsers. By 2008...