13
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-07-05

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

Node.js console.dir

const menu = {
  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 } }
  }
}
*/
13
3
0

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
  3. You can use dark theme
What you can do with signing up
13
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?