How do I view what is in "[object Object]"?

I’m using console.log() and for some items, I’m seeing this [object Object], which makes it difficult to troubleshoot. How can I actually see which object this is referring too?

Press F12 key in your browser(Chrome highly recommended).
And you will see a console.
It will help you lot in your challenges and troubleshooting.
Hope that helps.

"[object Object]" is the default string representation of an object. Once it’s been converted to a string, there’s no way to get info about the original object from that string.

However, console.log-ing an object should not usually convert it to a string. What’s your code? And are you viewing the console through a standard browser such as Chrome, Firefox, etc. or something else?

1 Like

Good to know, I’ll give that a shot!

Ah, makes sense. I was not viewing it through a browser, I was viewing it through the freeCodeCamp UI (while using chrome).

Use console.log() in the console i told you about.

Hey @dkang17,
Actually every Object have a toString() method in it’s proto .
So, if you like make a object :-

let obj = {};
obj.toString() //"[object Object]"

Then it will gave the string format of the object.
For more method go to your console and type :

obj.__proto__  //gave you the list of all methods
1 Like

if the other answers didnt help
you can try run a foreach on object keys method
to peel the object layers so u nail the values


1 Like

This solved the issue for me! Thank you!