SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2010
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    seeing the contents of a javascript object, how do i do it

    I come from php, where I use var_dump to see the contents of a object.

    In javascript there is no var_dump, so how do you guys see the contents of your objects?

    I would like an easy way to see js objects, maybe firebug does it and a function to dump the contents of an object.

    Thanks in advance,

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,147
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    console.log(varname) for chrome and firefox w/ firebug.
    The only code I hate more than my own is everyone else's.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    If you go into the develop tools in any browser (other than Firefox which doesn't have it unless you install the Venkman extension) you will find a full debugger there that is similar to that available in many other languages (and which you will therefore find much easier to work with than firebug - which is intended more for use with HTML and CSS and so works differently from the way a programmer would expect).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •