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 n开发者_运维知识库ot b?
Inquiring minds want to know.
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.
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!
you might be using a variable that is used in the json library. Try choosing a variable that isn't very common.
精彩评论