I am very new to javascript. When I do a typeof variable name, I get object{}. I need to look at the contents of this object. How would I do that in javascript?
Asked
Active
Viewed 52 times
0
-
Use developer tools, e.g. firebug. – simonzack Aug 11 '14 at 15:07
-
Click on that `object{}`. – Bergi Aug 11 '14 at 15:08
-
Uh, can you show us what exaclty you do with `typeof`, and where you enter that? – Bergi Aug 11 '14 at 15:09
-
Can you elaborate on what envrionment you're talking about? Are you in the browser, in Node, in a Phonegap app, etc? – Paul Aug 11 '14 at 15:09
-
@Paul, I am using chrome. I am trying to assign the values in object to another variable. I need to see what the object looks like. – user1471980 Aug 11 '14 at 15:25
1 Answers
0
You can use developer's console (Chrome console / Firebug / etc) or just convert your object to string:
var objAsString = JSON.stringify(yourVariable);

hsz
- 148,279
- 62
- 259
- 315
-
when I do data=JSON.stringify(data); I get {}. How do look inside of {}? – user1471980 Aug 11 '14 at 15:35
-
If you're getting {} then it's an empty object, there is nothing inside it. – Paul Aug 11 '14 at 17:42