Objects in the Firebug Console

This is an extension of the question I posted here .

I am having problems manipulating js objects and I think this has something to do with the scope or how the objects are populated. I am trying to use Firebug to figure out the essence of the problem, and have found one inconsistency that I cannot explain. Does anyone know why sometimes Console will show such an object : enter image description here

Where it shows the contents of an object

And sometimes like this:

enter image description here

If it looks as if the object is empty

However, the object is not empty - when I click on the Object {} in the screenshot above, they take me to the DOM inspector, which surely shows the contents of this object enough: enter image description here

Needless to say, it works in the first way (in which I hardcoded the keys / values ​​of the object), but not the second way (in which they are dynamically added). I think if I can understand why Console displays these two seemingly similar objects in different ways, I can get the bottom of the problem in my code. And I apologize if asking the same question twice is a bad form, but I decided it was a question related to Firebug and another one related to javascript ...

+2
source share
1 answer

SOLVED is actually quite simple in retrospect, and I think that @amnotiam was on the right track with his last comment. It happens that I call console.log() after creating the object, but before the values ​​are added. When I click on it to check it in the DOM, all values ​​have been added.

Read more about the response to the original message HERE .

0
source

All Articles