JavaScriptのオブジェクトを見る

JavaScriptのオブジェクトを全部展開してみたいなぁという時に,

var printobj = function(x){
  (function(x, indent, output){
    for(i in x){
      output(indent + i + ': ' + x[i]);
      if(typeof x[i] == 'object'){
        arguments.callee(x[i], '  ' + indent, output);
      }
    }
  })(x, '', console.log)
}

としたら便利だよ.

それだけ.

あわわわ...toSource()なんてあったの?



更に追記

console.dirでいいじゃん