Is there a way to see the information contained within [object][object] using firebug?

Go To StackoverFlow.com

1

I'm using console.log(variable) and firebug to examine javascript code. Occasionally, I get [object][object] as the value. Is there anyway of getting more information than just [object][object]?

EDIT: [object Object] is not clickable

EDIT2: I was able to log the information using console.log("My EPIC Object", epicObject);

2012-04-05 15:21
by TryHarder


3

Click on it and you will see what it contains (as long it is not a string).

click it

Fiddle: http://jsfiddle.net/maniator/YEaW3/

2012-04-05 15:22
by Neal
Thanks for your quick response Neal. Unfortunately, [object][object] isn't clickable for me. I've been able to examine other objects by clicking them, but not [object][object - TryHarder 2012-04-05 15:28
@Neal awesome answer - reevesy 2012-04-05 15:28
@moomoochoo are you sure you are not logging a string? Please make a fiddle with your code so we can see what you are doing - Neal 2012-04-05 15:30
It's possible that it is a string, but I don't really know. I'm examining the script to try and understand it. Is an object only unclickable in firebug when it is a string or are there other possibilities - TryHarder 2012-04-05 15:39
@Neal Sorry I'm not able to make a fiddle with this code - TryHarder 2012-04-05 15:50
@moomoochoo It sounds like you are coercing the Object into a String, typically achieved through concatenation, eg: console.log("My EPIC Object: " + epicObject). This is better logged via console.log("My EPIC Object", epicObject); - JonnyReeves 2012-04-05 15:55
@JonnyReeves That worked for me. Thank you so much! Could you put your reply as an answer - TryHarder 2012-04-05 16:06
@moomoochoo oy, that is my answer. you were displaying it as a string, therefore it did not display.. - Neal 2012-04-05 16:08
@Neal I appreciate your answer, but I wanted to know how to SEE the information contained within [object][object] which is what JohnnyReeves gave. As it is, your answer doesn't solve my problem. I'm sorry if I sounded rude - TryHarder 2012-04-05 16:19
@Neal if you edit your answer to include the console.log info I will mark it up (or choose it as the answer if Johnny doesn't post an answer (because I said I would accept his)) - TryHarder 2012-04-05 16:20
@moomoochoo I said in my answer that it would work if it was not a string, and you were logginf a string, thereofre it did not work - Neal 2012-04-05 16:24
Hey what the hell? What about my points, my precious points? - JonnyReeves 2012-04-06 07:41


-1

You could try logging it with console.log(JSON.stringify(myObject)).

2012-04-05 16:07
by Trax72
Ads