O'Reilly logo

JavaScript at Scale by Adam Boduch

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

Logging and debugging

Part of coping with failure in a large-scale JavaScript application is producing the right information. The most obvious place to start is the error console, where uncaught exceptions are logged, or just plain error messages generated using console.error(). Some error messages lead to quick fixes, while others send programmers on a wild goose chase.

Apart from logging errors as they happen, we might also want to log situations where something erroneous is about to happen. These are warning messages and they're not used as much as they should be in frontend applications. Warnings are especially useful in diagnosing the more insidious problems with our code, as they leave a trail of clues in the wake of a failure.

The user doesn't ...

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