By using this debugger, you can look deep into the code as it runs. It will allow you run the code, one line at a time, and each time, either adding extra code on the fly (without editing the original file), or checking how variables change in the run of the program.
If you want to have live variables values in the Variables tab you should end each line of code by semicolon.
if (document.all) do something) or page properties (f.e
window.pageXOffset), you should debug your document in the corresponding browser’s debugger (e.g Microsoft Script Debugger or Venkman).
Once Debuger has started up, it should look something like below.
Panel called "Source code" contains loaded code from current document. You can close a tab and reopen code by double-clicking corresponding line in the "Loaded Scripts" panel.
Output panel contains output window, which displays results of
document.write method and Evaluate field.
So let's try this. Write in
(3 + 6) *7 , in the Evaluate field, and press enter:
Go a little further, and declare something, say Num (set it to 133):
String.fromCharCode(112, 108, 97, 105, 110).
If you want, you can also try to execute a function or get (set) a variable current value.
The various buttons are, "Step over", "Step into" and "Step out". You can mouse over these buttons to get a tooltip.
Let's try to play with code below.
Press multiple times the buttons "Step Into" (F11), "Step Over" (F12) or "Step Out" (F10 if the current line is inside the function).
You will see the results of debugging in the "Output" panel, current values of variables in the "Variables" tab and executing functions in the "Call Stack" tab.
Here, you can enter various variables, and as you step through your code, it will update to reflect the value of that variable/property as it changes through the code. So in a way, it acts like the Variables panel, just without all the stuff you don't want to see.
Imagine, that whatever you put inside of Watches, gets evaluated. So if you have a function, where there exists a variable Z, going eval("Z"), will return Z's value.
Using only stepping has its drawback. By stepping, you're forced to step through all the steps of a script and if you decide you wanted a stop here or there you need breakpoints.
Breakpoint causes debugger to halt, but only if the line is reached by executing code.
Note! You can toggle breakpoint only if line is marked by yellow (red) circle.
You can see the list of breakpoints in the "Breakpoints" tab.
See also other windows: Library Snippets
Functions / Variables