Common Mistakes, Debugging, and Error Handling
Jeremy McPeak, Paul Wilton · 2015
This chapter discusses the top seven JavaScript coding mistakes. It explains how one can cope with errors when they do happen to prevent users from seeing your coding mistakes. The chapter then talks about the debugging tools in Microsoft's Internet Explorer (IE11), Firebug (an add-on for Firefox), Chrome's Web Inspector, and Opera's Dragonfly. It highlights how these tools can be used to step through a code and check the contents of variables while the code is running, a process that enables one to hunt for difficult bugs. The debugging tools available for Firefox are covered here. JavaScript is traditionally looked upon as a difficult language to write and debug due to the lack of decent development tools. Debugging is generally universal across all browsers, and even languages. The console logs JavaScript errors and enables you to execute code within the context of the line at which the debugger is stopped.