LoginSignup
188

More than 5 years have passed since last update.

JavaScriptでオブジェクトの内容が知りたい時

Posted at
var obj = {
 test: {
   a: 1,
   b: 2
 }
}

//頑張って書いていた…
console.log('obj.test.a:' + obj.test.a);
console.log('obj.test.b:' + obj.test.b);

//実はこれで楽だった!
console.log(JSON.stringify(obj));

//こっちはもっと凄かった!
console.dir(obj);

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
188