views:

94

answers:

3

Here is a short transcript from my firebug console:

>>> var a = {"name": "bob"};
>>> a
undefined name=bob
>>> a.name
"bob"
>>> b = 10
10
>>> b
10

Why does firebug print "undefined"? Why on a and not b?

Inquiring minds want to know.

+1  A: 

Which version are you using? To me it prints

>>> var a = {"name":"bob"};
>>> a
{ name=bob }

I'm using Firebug 1.4.5/Firefox 3.5.5.

GmonC
1.4.0b4 on Linux. I guess its time to upgrade!
Jose M Vidal
yup, that was it, I guess it was a bug.
Jose M Vidal
+1  A: 

After you've created var a = {"name": "bob"}; in the Console, you can always switch over to Script -> Watch and then enter your a there to get a nice representation of your object/variable/element/whatever.

What's odd is that when I do exactly what you did, I don't see Undefined name=bob, I see Object name=bob (which is probably what you were expecting, and hence your question).

Good luck!

Funka
I'm using Firefox version 3.0.15 with firebug 1.4.5, by the way...
Funka
thanks for the Watch tip!
Jose M Vidal
A: 

you might be using a variable that is used in the json library. Try choosing a variable that isn't very common.

prime_number