> [[[ "test" ]]] [ [ [ 'test' ] ] ] > [[[[ "test" ]]]] [ [ [ [Object] ] ] ]In this case [Object] stands for [ "test" ].
Option 1: a single line of JSON.
> console.log("%j", [[[[ "test" ]]]]); [[[["test"]]]]Option 2: Use JSON.stringify() [1] to print an indented tree.
var tree = function(x) { console.log(JSON.stringify(x, null, 4)) }; > tree([[[[ "test" ]]]]); [ [ [ [ "test" ] ] ] ]Warning: Anything non-JSONy will not be printed.
> console.log("%j", { foo: function() {}, bar: "abc" }) {"bar":"abc"}
Option 1: Use util.inspect() directly.
var util = require("util"); > function ins(value) { console.log(util.inspect(value, false, null)); } > ins([[[[ "test" ]]]]) [ [ [ [ 'test' ] ] ] ] > ins({ foo: function() {}, bar: "abc" }); { foo: [Function], bar: 'abc' }
Option 2: Use console.dir(), which internally calls util.inspect(). Drawback: Stops after a nesting depth of 2.
> console.dir([[[[ "test" ]]]]) [ [ [ [Object] ] ] ] > console.dir({ foo: function() {}, bar: "abc" }); { foo: [Function], bar: 'abc' }