Re: Here's the link
"7stud" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.jsdebugger |
|---|---|
| Message-ID | <[email protected]> |
http://www.svendtofte.com/code/learning_venkman/basics.php "7stud" <[email protected]> wrote in message news:[email protected]... > Hi, > > I'm trying to do an example in the Javascript debugger tutorial here(page 3 > "Basic Debugging"): > http://www.svendtofte.com/code/lear...kman/basics.php > > Here is the example script: > Code: > > 3) <script> > 4) var a = 1; > > 5) function test(a) { > 6) var t = "passed : "; > 7) return t + a; > 8) } > > 9) var b = test(a); > 10) document.write("<p>" + b + "</p>"); > 11) </script> > > > > I clicked the Stop button in the debugger and reloaded the script, and Line > 4 was highlighted in yellow(the tutorial says it should be line 3). I typed > 'a' into the Interactive Session input line, and hit return. I got an error > message sayng 'a' was not defined. So far, so good. > > I clicked on Step Into and then line 5 was highlighted. I typed 'a' into the > Interactive Session input line again, and hit return. I got this: > > < 001: a > >$[0] = [void] void > > The tutorial says I should get a value of 1 for a. That doesn't appear to be > giving me a value of 1 for a. > > Next, I clicked Step Into again, and line 9) was highlighed in yellow. I > typed in 'a' again just to see what would happen, and I got the same thing: > > < 0001: a > >$[0] = [void] void > > Once again, it doesn't appear that's a value of 1 for a. I typed in 'b', and > as expected I got an error saying b was not defined. Then, I typed in > 'test(a)'. The tutorial says I should've got: > > passed : 1 > > for test(a). But, I got: > > <0001: test(a) > > $[1] = [string] "passed : undefined" > > What the heck is going on? > > I clicked Step Into again and it jumped up to line 4). Huh? Why not line 5)? > I entered 'a' in again, and this is what I got again: > > < 0001: a > >$[0] = [void] void > > I clicked Step Into again and advanced to line 5). I typed 'a' in again: > > <0001: a > >$[0] = [integer] 1 > > Finally!! A value of 1 for 'a'. Can anyone explain this debugger's behavior? > Why no value for 'a' sooner? > > Then, when I click Step Into successively after that, this is what happens: > > line 9) > line 6) > line 7) > line 9) > line 10) > > It just doesn't seem to make sense. The whole sequence is: > > 4) > 5) > 9) > > 4) > 5) > 9) > > 6) > 7) > 9) > 10) >