views:

4913

answers:

3

Hi, I would like to see the structure of object in JavaScript (for debugging). Is there anything similar to var_dump in PHP? Thanks

+7  A: 

Install Firebug for Firefox and do this:

console.log(myvar);

Then you will get a nicely mapped out interface of the object/whatever in the console.

Check out the console documentation for more details.

Paolo Bergantino
thanks, i use Firebug but i didn't know about this feature. also thanks for link.
perfectDay
+3  A: 

Please check out this post: "jQuery: print_r() display equivalent?"

zodeus
+3  A: 

Firebug.

Then, in your javascript:

var blah = {something: 'hi', another: 'noway'};
console.debug("Here is blah: %o", blah);

Now you can look at the console, click on the statement and see what is inside blah

Cory R. King