O'Reilly logo

JavaScript Testing by Liang Yuxian Eugene

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

Time for action—using alert to inspect your code

This example is similar to what you have done in the previous example. In this example, you will be required to insert alert in the appropriate places in order to check which part of the code is running. In some cases, you will need to pass values to the alert method and see if the value is the one that you want.

To be honest, it would be tedious to tell you step-by-step where you should place the alert method, especially as the bulk of the code in this example is similar to the previous one. However, to make things easier for you to follow, we'll start immediately with the entire program, after which we'll explain to you the rationale behind the location of the alert methods and the values that ...

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