Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9047

console.logで配列やオブジェクトが省略されてしまうときはconsole.dirを使おう

$
0
0

console.dirの第2引数にオブジェクト{depth: null}を渡すと深い階層も省略されずに全部見れます。

Node.js console.dir

constmenu={main:{currey:500,udon:450,rice:150},side:{soup:{misoshiru:{wakame:250,asari:250},potage:{corn:250,potato:250}},dessert:{icecream:{vanilla:100,chocolate:100}}}}console.log(menu)/*
{
  main: { currey: 500, udon: 450, rice: 150 },
  side: {
    soup: { misoshiru: [Object], potage: [Object] },
    dessert: { icecream: [Object] }
  }
}
*/console.dir(menu,{depth:null})/*
{
  main: { currey: 500, udon: 450, rice: 150 },
  side: {
    soup: {
      misoshiru: { wakame: 250, asari: 250 },
      potage: { corn: 250, potato: 250 }
    },
    dessert: { icecream: { vanilla: 100, chocolate: 100 } }
  }
}
*/

Viewing all articles
Browse latest Browse all 9047

Latest Images

Trending Articles



Latest Images