On Sep 16, 7:06 pm, Squeg <[email protected]> wrote:
> firefox: 3.5.3, firebug: 1.4.2
>
> I was working out some test code to demonstrate javascript behavior
> when passing objects to functions, using console.log to report state.
> I noticed something unexpected. When i modify the contents of an
> array, all calls to console.log containing that array report the final
> state of the array, not the state at the time the log request is made.

The meaning of
console.log( "ia = ", ia );
is "Print the string "ia -=" and then an object point to ia'
So when you later click on 'ia' you are following the pointer, so you
will get the current value.

To get the value of the array elements, log them.

If you imagine that an array can have arbitrary object with arbitrary
properties you can see why the other solution of following all of the
pointers would not work out.

There is a possible delay in logging, to improve performance the
printing is decoupled from the calling code through a queue. But that
does sound like the issue you have.

jjb
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/firebug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to