Printing out entire JavaScript objects

Sometimes you want to print out more than just two levels of depth of a JavaScript object before seeing [object Object] all over the place and not having any additional visibility. Take a look at this object:

obj = 
    a:
        b:
            c: 1

If you wanted to see the value of c and used console.log to print the object, you would see {a: {b: [object Object]}}. Nothing about c at all.

Instead of using console.log, you can use console.dir which essentially aliases right to util.inspect which can also be used to print the whole object. Use console.dir(object, {depth: null}) to print out the entire object, or specify a custom depth if you don't care about any data past a certain level. Hopefully this is as useful to you as it was to me when attempting to debug large objects.