O'Reilly logo

JavaScript® 24-Hour Trainer by Jeremy McPeak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 38. Debugging with Firebug

Before JavaScript became the world's most popular programming language, it was actually looked down upon as being a quirky language that wasn't worth any real developer's time. This outlook on JavaScript was primarily caused by two issues:

  • Developers didn't fully understand the language.

  • There were no decent development tools available.

The popularity of web applications and Ajax essentially pushed JavaScript into the limelight. As a result, developers finally began to understand the language, and some of them started building development tools for JavaScript.

Today, there are a variety of tools available to developers. Probably the most important are the JavaScript debuggers present in all major browsers. With a debugger, you can pause the code execution of your script, and with a process known as stepping, you can execute the lines one at a time to find bugs in your code.

Debugging is universally necessary across all browsers and languages. Although some debugging tools offer features that other tools may not have, all debugging tools are based upon the following concepts:

  • Breakpoints: tell the debugger where it should break or halt code execution. You can set a breakpoint on any line in your code; the debugger will pause there.

  • Stepping: lets you execute one statement of code at a time. There are three ways to step through code:

    1. Step Into: executes the next line of code. In the case of a function, the debugger executes the function and breaks at the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required