11.1. The Problem
Debugging JavaScript code has traditionally been very difficult. For a long time, browsers had little or no support for JavaScript developers. Early editions of Safari had no JavaScript console and Opera only added a console after version 8. Firefox included a JavaScript console in version 1.0 but had no built-in support for anything other than outputting JavaScript messages. Internet Explorer, as of version 7.0, still has no JavaScript console, relying solely on pop-up error messages when something goes wrong.
With these tools, or lack thereof, most developers resorted to an age-old way of debugging: calling alert() at various spots in the code. This was useful for determining if code execution reached a certain block of code or to figure out the value of a particular variable. Of course, this is not an optimal solution since it interrupts the flow of code. Given the loosely typed nature of JavaScript, the lack of debugging tools stymied the growth of JavaScript solutions. It wasn't until true JavaScript debuggers arose that developers were able to build more extensive applications.
Microsoft introduced the Microsoft Script Debugger, which was a free add-on utility for Internet Explorer. It was a simple program that could intercept JavaScript errors and open up the offending code in a text viewer. Script Debugger also displayed the call stack, but beyond that, had little more to offer. Microsoft did follow this up by allowing Visual Studio to interact with Internet ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access