7 out of 10 rated this helpful - Rate this topic

debugger Statement (JavaScript)

JavaScript - Internet Explorer 10

Suspends execution.

debugger

You can place debugger statements anywhere in procedures to suspend execution. Using the debugger statement is similar to setting a breakpoint in the code.

The debugger statement suspends execution, but it does not close any files or clear any variables.

Note Note

The debugger statement has no effect unless the script is being debugged.

This example uses the debugger statement to suspend execution for each iteration through the for loop.

Note Note

To run this example, you must have a script debugger installed and the script must run in debug mode.

Internet Explorer 8 includes the JavaScript debugger. If you are using an earlier version of Internet Explorer, see How to: Enable and Start Script Debugging from Internet Explorer.

for(i = 1; i<5; i++) {
   // Print i to the Output window.
   Debug.write("loop index is " + i);
   // Wait for user to resume.
   debugger
}

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Also supported in Windows Store apps. See Version Information.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.